On May 9, 1:55 pm, RubyonRails_newbie <[email protected]> wrote: > Hello, > > Good point - I have tried to amend the code like below, but i get > errors: > > ORIGINAL CODE: > Blogpost.find(params[:id]).comments.create(params[:comment]) > > AMENDED CODE 1: > Blogpost.find(params[:id, :user_id]).comments.create(params[:comment]) > THis returns error: wrong number of arguments (2 for 1) > > AMENDED CODE 2: > Blogpost.find(params[:id]).comments.create(params[:comment,:user_id]) >
You either need to merge your hash of params from the form with the user_id you want to set or you need to set the user_id on the comment afterwards. Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

