title: Rails: split a nested form into partials
body: <p>I have a nested form which works perfectly fine, however, I'm trying to figure out how to split that nested form into a partial.</p>
  
  <p>original form:</p>
  
  <pre><code>  &lt;%= form_for(@user) do |f| %&gt;
  
      &lt;%= f.fields_for :achievements, Achievement.new do |ff| %&gt;
  
      &lt;div class="field"&gt;
        &lt;%= ff.label :certification_name, 'Cert Name' %&gt;
        &lt;%= ff.text_field :certification_name %&gt;       
      &lt;/div&gt;
  
      &lt;% end %&gt;&lt;!-- fields_for --&gt;
  
      &lt;%= f.submit 'Save', id: "submit-achievement", class: 'btn btn-primary' %&gt; 
  </code></pre>
  
  <p>Here's what I'm trying to do....</p>
  
  <pre><code>  &lt;%= form_for(@user) do |f| %&gt;
  
      &lt;%= f.fields_for :achievements, Achievement.new do |ff| %&gt;
  
        &lt;%= render partial: 'achievements/new_certification' %&gt;
  
      &lt;% end %&gt;&lt;!-- fields_for --&gt;
  
      &lt;%= f.submit 'Save', id: "submit-achievement", class: 'btn btn-primary' %&gt;
  </code></pre>
  
  <p>here's the partial.</p>
  
  <pre><code>&lt;div class="field"&gt;
    &lt;%= ff.label :certification_name, 'Cert Name' %&gt;
    &lt;%= ff.text_field :certification_name %&gt;       
  &lt;/div&gt;
  </code></pre>
  
  <p>the problem is that it doesn't know what to do with the 'ff' variable.</p>
  
  <pre><code>ActionView::Template::Error (undefined local variable or method `ff' for #&lt;#&lt;Class:0x007fdccd5498c0&gt;:0x007fdcc04894d8&gt;):
  </code></pre>