title: form_for with association - how to provide parent id?
body: <p>Assuming the <code>Post</code> - <code>Comment</code> model with the nested resources:</p>
  
  <pre><code>resources :posts do
    resources :comments
  end
  </code></pre>
  
  <p>How should the <code>app/views/comments/_form.html.haml</code> (erb will do as well) look like so that it also provides id of the post to attach the comment to?</p>
  
  <p>Current only one way I know is to manually add hidden input with the post id. It looks dirty to me.</p>
  
  <p>Is there any better way? I expected rails to understand the nested resource and automatically include the <code>post_id</code> as a hidden input.</p>
  
  <pre><code>= form_for [@post, @comment] do |f|
    .field
      f.label :body
      f.text_field :body
      hidden_field_tag :post_id, @post.id
    .actions
      = f.submit 'Save'
  </code></pre>
  
  <p>EDIT: Using Mongoid, not ActiveRecord.</p>
  
  <p>Thanks.</p>