Closed ryohakjae114 closed 1 month ago
この変更は、Railsアプリケーションにコメント機能を追加するためのものです。投稿にコメントを追加できるようにし、システムテスト、モデル、ビュー、コントローラ、マイグレーションの全体にわたって広範な変更が行われています。
ファイルパス | 変更内容の概要 |
---|---|
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 | いいねボタン表示ロジックの追加、ユーザーのいいねステータスに基づく動的レンダリング |
コメントが舞う、虹の投稿、 ウサギの愛で、コードに導かれ。 いいねの星を掴むボタン、 みんなで楽しい空間を創ろう。 今夜もコードの魔法が光る。
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?
@uekkie パーシャル元でcurrent_userを変数として渡すようにしたのですが、こういうことでしょうか??
https://github.com/ryohakjae114/miniblog/pull/44/commits/6501317f393d961748d60027ff94f312f81e2358 https://github.com/ryohakjae114/miniblog/pull/44/commits/91eb21a759046f256d3607e4a5549da499347f25
Changes Lines
+248 additions, -139 deletions