title: Passing a local variable to a hidden_field in a partial
body: <p>I am trying to pass these local parameters to a partial form, and they are being passed to hidden_fields. I can't put the values straight into the forms because they will change. Any help would be greatly appreciated.</p>
  
  <p>I have:</p>
  
  <pre><code>    &lt;% form_for :user, @user, :url =&gt; { :action =&gt; "create", :controller =&gt; "users"} do |f| %&gt;
        &lt;%= f.error_messages %&gt;
        &lt;%= render :partial =&gt; "form", :locals =&gt; { :f =&gt; f, :position =&gt; 'Company Commander', :battalion_id =&gt; @battalion.id, :company_id =&gt; c.id} %&gt;
        &lt;%= f.submit "Register" %&gt;
      &lt;% end %&gt;
  </code></pre>
  
  <p>The _form.html</p>
  
  <pre><code>&lt;%= f.hidden_field (:position, :value =&gt; :position) %&gt;
  &lt;%= f.hidden_field (:battalion_id, :value =&gt; @battalion.id) %&gt;
  &lt;%= f.hidden_field (:battalion_id, :value =&gt; @company.id) %&gt;
  
  &lt;%= f.hidden_field (:roles, :value =&gt; "Company") %&gt;
  
  &lt;%= f.label (:name, "Name:") %&gt;
  &lt;%= f.text_field :name%&gt;
  &lt;br /&gt;
  &lt;%= f.label (:login, "Login:") %&gt;
  &lt;%= f.text_field :login %&gt;
  &lt;br /&gt;
  &lt;%= f.label (:email, "E-Mail:") %&gt;
  &lt;%= f.text_field :email%&gt;
  </code></pre>