commentモデルをNoteモデルとUserモデルに紐付けてbuildしたいです。
現在は下記のように@noteだけに紐付いていて、Userモデルとの紐付けができていません。
追加でcurrent_userとも紐付けるにはどのように記述すれば良いのでしょうか?
rails
1#app/controllers/comments_controller.rb 2 3 def create 4 @note = Note.find(params[:note_id]) 5 @comment = @note.comments.create(comment_params) 6 redirect_to @note 7 end 8
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。