title: Can't mass-assign protected attributes: works_attributes, educations_attributes in rails nested model
body: <p>I am trying to save the model called applicant with nesting to work and education model. When saving the model, I am getting:</p>
  
  <blockquote>
    <p>Can't mass-assign protected attributes: works_attributes, educations_attributes error.</p>
  </blockquote>
  
  <p>I am also getting an error for an undefined method `klass' for nil:NilClass. I am using Rails 3.2.</p>
  
  <p>My model code:</p>
  
  <pre><code>applicant.rb
  
  class Applicant &lt; ActiveRecord::Base
    attr_accessible :first_name, :last_name, :location, :email, :mob_no, :alternative_no, :linkedin, :facebook, :twitter, :message, :resume, :job_id
    has_many :works, :dependent =&gt; :destroy
    has_many :educations, :dependent =&gt; :destroy
    accepts_nested_attributes_for :works, :reject_if =&gt; lambda { |a| a[:content].blank? }, :allow_destroy =&gt; true
  
    accepts_nested_attributes_for :educations, :reject_if =&gt; lambda { |a| a[:content].blank? }, :allow_destroy =&gt; true
  
  end
  
  
  work.rb
  
  class Work &lt; ActiveRecord::Base
    attr_accessible :applicant_id, :company_name, :description, :end_month, :end_year, :start_month, :start_year, :title
    belongs_to :applicant
  end
  
  
  education.rb
  
  class Education &lt; ActiveRecord::Base
    attr_accessible :applicant_id, :end_month, :end_year, :institution_name, :major, :start_month, :start_year, :title
    belongs_to :applicant
  end
  </code></pre>