title: How do I use nested attributes with the devise model
body: <p>I have the same issue as <a href="https://stackoverflow.com/questions/3027555/creating-an-additional-related-model-with-devise">Creating an additional related model with Devise</a> (which has no answer).</p>
  
  <p>I have overridden the devise view for creating a new user and added a company name, I have changed the model to use accepts_nested_attributes_for</p>
  
  <p>There are no errors, but it is <strong>not adding the nested record</strong> and I don't have a controller where I can modify the request.</p>
  
  <p>I have the following (shortened to make it readable):</p>
  
  <p><strong>routes.rb</strong></p>
  
  <pre><code>map.devise_for :users
  map.resources :users, :has_many =&gt; :companies
  </code></pre>
  
  <p><strong>user.rb</strong></p>
  
  <pre><code>has_many :companies
  accepts_nested_attributes_for :companies
  devise :registerable ... etc
  </code></pre>
  
  <p><strong>company.rb</strong></p>
  
  <pre><code>belongs_to :user
  </code></pre>
  
  <p><strong>new.html.erb</strong></p>
  
  <pre><code>...
  &lt;% form_for resource_name, resource, :url =&gt; registration_path(resource_name) do |f| %&gt;
  ...
    &lt;% f.fields_for :company do |company_form| %&gt;
      &lt;p&gt;&lt;%= company_form.label :name %&gt;&lt;/p&gt;
      &lt;p&gt;&lt;%= company_form.text_field :name %&gt;&lt;/p&gt;
    &lt;% end %&gt;
  ...
  </code></pre>
  
  <p>UPDATE:
  I didn't add :company to the attr_accessible list in the User model.</p>