[Rails] Re: Associations with value passing

2016-02-16 Thread Rob Lane
If you just want to hide the field use: <%= f.hidden_field :post_id, value: params[:id] %> See - http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-hidden_field On Tuesday, February 16, 2016 at 4:48:17 AM UTC-8, Ruby-Forum.com User wrote: > > Walter Davis wrote in

[Rails] Re: Associations with value passing

2016-02-16 Thread Szabolcs Toth
Walter Davis wrote in post #1181415: >>@comment = Comment.new(comment_params) >>@comment.post_id = params[:id] >> >> But it doesn't work, what did I miss? Thank you! >> > > If you're sending this to the comments controller, then set the post_id > attribute in that form. id always refers to