title: How can I stop a fields_for nested form duplicating with records added?
body: <p>I have a table of venues and I'm adding offers to each venue using a nested form on the venues edit page. However, each time I add a new offer the fields_for form saves the text entered and creates a new blank form for another offer record to be added. </p>
  
  <p>I just want the one 'add new offer' form not one for each record added.</p>
  
  <p><b>no offers added - this is fine:</b>
  <img src="https://i.stack.imgur.com/OKyBR.png" alt="enter image description here"></p>
  
  <p><b>one offer added - now theres 2 'add new offer' forms and an unwanted blank offer partial:</b></p>
  
  <p><img src="https://i.stack.imgur.com/5q8l5.png" alt="enter image description here"></p>
  
  <p><b>This is what I want it look like after adding one offer:</b>
  <img src="https://i.stack.imgur.com/UzAQF.png" alt="enter image description here"></p>
  
  <p>The number of new blank offer forms and blank partials changes with the number being built in the controller (at the minute its 1)</p>
  
  <p><b>venues controller</b></p>
  
  <pre><code>class VenuesController &lt; ApplicationController   
    def edit
      @venue = Venue.find(params[:id])
      1.times { @venue.offers.build }
    end
  
    def update
      @venue = Venue.find(params[:id])
      if @venue.update_attributes(params[:venue])
        flash[:notice] = 'Venue updated successfully'
        redirect_to :back
      end
    end
  end
  </code></pre>
  
  <p><b>venues model</b></p>
  
  <pre><code>class Venue &lt; ActiveRecord::Base
    has_many :offers
    accepts_nested_attributes_for :offers
  end
  </code></pre>
  
  <p><b>venues edit.html.erb</b></p>
  
  <pre><code>      &lt;%= form_for @venue do |f| %&gt;
  
          &lt;h2 class="venue_show_orange"&gt;Offers&lt;/h2&gt;
  
          &lt;div class="edit_venue_details"&gt;
            &lt;% if @venue.offers.count.zero? %&gt;
              &lt;div class="no_offers"&gt;
                No offers added yet.
              &lt;/div&gt;
            &lt;% else %&gt;
              &lt;%= render :partial =&gt; 'offers/offer', :collection =&gt; @venue.offers %&gt;
            &lt;% end %&gt;
  
            &lt;div class="clearall"&gt;&lt;/div&gt;
  
            &lt;h2 class="edit_venue_sub_header"&gt;Add a new offer&lt;/h2&gt;    
  
            &lt;%= f.fields_for :offers do |offer| %&gt;
              &lt;p class="edit_venue"&gt;title: &lt;br&gt;
              &lt;%= offer.text_field :title, :class =&gt; "edit_venue_input" %&gt;&lt;/p&gt;
            &lt;% end %&gt;
          &lt;/div&gt;
  
          &lt;button class="submit_button" type="submit"&gt; Save changes&lt;/button&gt;
        &lt;% end %&gt;
  </code></pre>
  
  <p>So how can I have just the one add new offer form on the venues edit page, which lets me add a new offer then blanks the form so it can be used again? Also, is there any way to prevent the blank offer partials being created? </p>
  
  <p>Thanks very much for any help its much appreciated!</p>