Target: save comment for idea model.
Form:
<%= form_for([@idea, IdeaComment.new], :validate => true) do |f| %>
<div class="control-group">
<div class="controls">
<%= f.text_area :text, :placeholder => 'some text', :rows => 5 %>
<%= validate_errors(IdeaComment.new) %>
</div>
</div>
<%= f.button 'Comment', :class => 'button grad-green', :type => 'submit' %>
<% end %>
Controller:
@idea_comment = IdeaComment.new(params[:idea_comment])
...
But if we take a look for params hash:

How to pass idea_id to “idea_comment”?
Client-side validation is conflicting with resource-oriented forms. Use regular server-side validation instead.
Explanation:
Resource-oriented forms post to a path based on nested resources:
Rails extracts
:idea_idfrom the request path and passes it in as a parameter. In thecreateaction, the association is set by direct assignment prior to saving:The problem with client-side validation is that it will fail and block form submission until
@idea_comment.idea_idis assigned, which doesn’t happen until after the form is submitted.