title: How do you pass options through a fields_for?
body: <p>I am trying to run this..</p>
  
  <pre><code>- f.fields_for :referrals do |qf|
  </code></pre>
  
  <p>But I would like to pass this, <code>@organization.referrals.select{|ref|ref.new_record?}</code> as well. This is so that the forms passed are exclusively new objects, and not older ones.</p>
  
  <p>I've tried to do this..</p>
  
  <pre><code>- f.fields_for :referrals do |qf|
    - if qf.object.new_record?
      = render :partial =&gt; 'referral_fields', :locals =&gt; {:qf =&gt; qf}
  </code></pre>
  
  <p>Which makes it display correctly in the view, but the params are still populated with every single previously created nested object.</p>
  
  <p>Which leads me to believe that I need to pass this option within the fields_for statement itself.</p>
  
  <p>I have also tried this :</p>
  
  <pre><code>- f.fields_for @organization.referrals.select{|ref|ref.new_record?} do |qf|
    = render :partial =&gt; 'referral_fields', :locals =&gt; {:qf =&gt; qf}
  </code></pre>
  
  <p>As well as this :</p>
  
  <pre><code>- f.fields_for :referrals, @organization.referrals.select{|ref|ref.new_record?} do |qf|
    = render :partial =&gt; 'referral_fields', :locals =&gt; {:qf =&gt; qf}
  </code></pre>
  
  <p>The first example will show and only allows to pass one object. Where as my form is to allow a dynamic number of duplicate nested forms. </p>
  
  <p>The second will display and pass all nested objects</p>
  
  <p><strong>App Info</strong></p>
  
  <pre><code>#organization.rb
  has_many  :referrals
  accepts_nested_attributes_for :referrals, :reject_if =&gt; proc { |attributes| attributes.all? { |k, v| v.blank? } }, :allow_destroy =&gt; true
  #referral.rb
  belongs_to :organization
  #referrals_controller.rb
  def new
    2.times { @organization.referrals.build }
    ....
  def create
    @referral = Referral.new(params[:referral])
    if @referral.valid? &amp;&amp; @organization.referrals &lt;&lt; @referral
      flash[:notice] = "Referrals saved."
      redirect_to new_organization_referrals_path(@organization)
    else
      render :action =&gt; :new, :layout =&gt; 'manage'
    end
  end
  </code></pre>