How to capture a comment's author then display in tooltip?
问题 I have a form attached to profiles where short comments can be submitted. I want to capture the author's name though so I can display it in a tooltip when hovering over the comment's body. In my create method in the controller I have: def create @comment = Comment.new(params[:comment]) @comment.save! redirect_to profile_path(@comment.profile) end Inside my migration: t.timestamps t.integer :profile_id t.string :author_id t.string :body Profile model: belongs_to :user accepts_nested_attributes