ryohakjae114 / miniblog

1 stars 1 forks source link

投稿に対するコメント一覧機能 #44

Closed ryohakjae114 closed 1 month ago

ryohakjae114 commented 1 month ago

Changes Lines

+248 additions, -139 deletions

Language Line Ratio Files Additions Deletions
Gemfile.lock 55.8% 1 +109 -107
Ruby 21.2% 13 +74 -8
Haml 20.2% 6 +56 -22
YAML 2.8% 1 +9 -2
coderabbitai[bot] commented 1 month ago

Walkthrough

この変更は、Railsアプリケーションにコメント機能を追加するためのものです。投稿にコメントを追加できるようにし、システムテスト、モデル、ビュー、コントローラ、マイグレーションの全体にわたって広範な変更が行われています。

Changes

ファイルパス 変更内容の概要
spec/system/posts_comments_spec.rb 投稿へのコメントの閲覧および追加に関するシステムテスト
app/models/comment.rb 新しいCommentモデルの導入。UserおよびPostとの関連付けとカウンターキャッシュの設定
app/models/post.rb Postモデルにコメント管理のための関連付けを追加
app/models/user.rb Userモデルにコメント管理のための関連付けを追加
app/views/shared/_posts.html.haml 投稿のレイアウトを簡略化して共有テンプレートをレンダリング
db/migrate/...create_comments.rb コメントテーブルを作成するためのマイグレーション
db/migrate/...add_comments_count_to_post.rb postsテーブルにcomments_countカラムを追加
db/schema.rb コメントテーブルとpostsテーブルのcomments_countカラムの作成を含むスキーマの更新
spec/factories/comments.rb コメントを生成するためのファクトリの追加
spec/system/posts_spec.rb 投稿に関するコメントの一覧表示テストの追加
app/controllers/posts_controller.rb 投稿の詳細表示アクションの追加
app/views/posts/show.html.haml 投稿の詳細表示テンプレートの追加
app/views/shared/_post.html.haml 投稿のレンダリングロジックの追加
config/routes.rb postsリソースのshowアクションを追加
db/seeds.rb シードデータの更新、投稿にコメントを追加
db/migrate/...add_index_user_and_post_to_comments.rb コメントテーブルのuser_idおよびpost_idへのインデックス追加
app/controllers/posts/likes_controller.rb いいね作成と解除のリダイレクトロジックの修正
app/views/shared/_comment.html.haml コメント表示用のカードレイアウト追加
app/views/shared/_follow_button.html.haml フォローボタン表示ロジックの追加
app/views/shared/_like_button.html.haml いいねボタン表示ロジックの追加、ユーザーのいいねステータスに基づく動的レンダリング

Poem

コメントが舞う、虹の投稿、
ウサギの愛で、コードに導かれ。
いいねの星を掴むボタン、
みんなで楽しい空間を創ろう。
今夜もコードの魔法が光る。

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
ryohakjae114 commented 1 month ago

@uekkie パーシャル元でcurrent_userを変数として渡すようにしたのですが、こういうことでしょうか??

https://github.com/ryohakjae114/miniblog/pull/44/commits/6501317f393d961748d60027ff94f312f81e2358 https://github.com/ryohakjae114/miniblog/pull/44/commits/91eb21a759046f256d3607e4a5549da499347f25