title: Why doesn't mongoid add my nested attributes on new()?
body: <p>I can't seem to figure out why Mongoid won't set the nested attributes for a child object when I create a new parent.  I want to create a new Folio, add one child Feature, then push it on the Folios array on Profile.</p>
  
  <p>I have a Profile, which embed many Folios, which embed many Features:</p>
  
  <pre><code>class Profile
    include Mongoid::Document
    include Mongoid::Timestamps::Updated
  
    #regular fields here; removed for brevity
  
    embeds_many :folios, class_name: "Folio"
  end
  
  class Folio
    include Mongoid::Document
    include Mongoid::Timestamps::Updated
  
    accepts_nested_attributes_for :features
    embedded_in :profile
  
    field :name
    field :desc
    field :order, type: Integer, default:0
    embeds_many :features
  
    attr_accessible :name, :desc, :order  
  end
  
  class Feature
    include Mongoid::Document
    include Mongoid::Timestamps::Updated
  
    embedded_in :folio
    belongs_to :project
  
    field :content_type, type: Integer  #ContentType
    field :content_id
    field :txt, type: String
    field :order, type: Integer, default:0
  
    attr_accessible :project_id, :content_type, :content_id, :txt, :order
  end
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>  def new
      @folio = Folio.new
      @folio.features.build
    end
  
    def create
      @folio = Folio.new(params[:folio])
  
      #@folio.features is still empty here.
  
      @profile.folios &lt;&lt; @folio
      @profile.save
      render "create_or_update.js"
    end
  </code></pre>
  
  <p>In create, the param hash looks good:</p>
  
  <pre><code>{"folio"=&gt;{"id"=&gt;"new", "name"=&gt;"new name", "desc"=&gt;"new description", "features_attributes"=&gt;{"0"=&gt;{"project_id"=&gt;"4ea0b68e291ebb44a100000a", "content_type"=&gt;"1", "content_id"=&gt;"4ea0b68e291ebb44a100000d", "txt"=&gt;"note here"}}}, "commit"=&gt;"Save", "action"=&gt;"create", "controller"=&gt;"folios"}
  </code></pre>
  
  <p>But @folio.features is still empty.</p>
  
  <p>This worked fine with AR, if I remember. Strangely, there is no features_attributes=() method on Folio.  I thought that was required for the nested attributes to work?  What am I missing?</p>
  
  <p>This is on Rails 3.1 with Mongoid 2.2.3.</p>