Devise Unpermitted parameter nested form
<p>I have a user model <code>parent</code> and and child model <code>patient</code>. I want to add patient related attributes in the patients model through devise(user) signup form, but the data is not saving in patient model.</p>

<pre><code>class RegistrationsController &lt; Devise::RegistrationsController

    def new
        build_resource({})
    resource.build_patient
    respond_with self.resource  
    end

    def create
    super
  end


end
private
 def sign_up_params
    params.require(resource_name).permit(:email, [patient_attributes:[:user_id, :phone, :address,:age]], :password, :password_confirmation)
  end
</code></pre>

<p>This is my user and patient models:</p>

<pre><code>class User &lt; ActiveRecord::Base
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable

  has_one :patient
  accepts_nested_attributes_for :patient
end
#####
class Patient &lt; ActiveRecord::Base
    belongs_to :user
end
</code></pre>

<p>This is the nested form:</p>

<pre><code>&lt;div class="field"&gt;
    &lt;%= f.fields_for :patient do |p| %&gt;

    phone &lt;%= p.text_field :phone %&gt;

    address &lt;%= p.text_field :address %&gt;

    age &lt;%= p.text_field :age %&gt;
    &lt;%end%&gt;
  &lt;/div&gt;
</code></pre>

<p>When I fill the form and click submit button these are the params: </p>

<pre><code> Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"b+5GjScdG1gSnPL1eRDMW9U6tWiL1+liJMHvBCWYO2DEqRPJIBKzpXE3HGHlDgJPVcB+ro3ZVi+fHmNCdri1Zw==", "user"=&gt;{"username"=&gt;"q", "email"=&gt;"kh1@gmail.com", "patient_attributes"=&gt;{"phone"=&gt;"444444", "address"=&gt;"lllllllll", "age"=&gt;"55"}, "password"=&gt;"[FILTERED]", "password_confirmation"=&gt;"[FILTERED]", "user_type"=&gt;"1"}, "commit"=&gt;"Sign up"}
**Unpermitted parameter: patient_attributes**
</code></pre>