I have completely lost with this simple problem. I have two model, Post
and Comment. I added the one-to_many associations. When I want to add a
comment to a certain post I use this:

<%= link_to 'Add comment', new_comment_path(id: post.id) %>

In the comments_controller.rb I have
 def create
    @comment = Comment.new(comment_params)
    @comment.post_id = params[:id]

But it doesn't work, what did I miss? Thank you!

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/b8675d6aca1ce38b6be0059004caf2b8%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to