title: How to handle multiple models in one rails form?
body: <p>I have the following models</p>
  
  <pre><code>class Survey &lt; ActiveRecord::Base
    has_many :survey_sections
    accepts_nested_attributes_for :survey_sections
  end
  
  class SurveySection &lt; ActiveRecord::Base
    belongs_to :survey
    has_many :questions
    accepts_nested_attributes_for :questions
  end
  
  class Question &lt; ActiveRecord::Base
    belongs_to :survey_section
    has_many :answers
    belongs_to :question_group
    accepts_nested_attributes_for :question_group
    accepts_nested_attributes_for :answers
  end
  
  class Answer &lt; ActiveRecord::Base
    belongs_to :question
  end
  
  class QuestionGroup &lt; ActiveRecord::Base
    has_many :questions
  end
  </code></pre>
  
  <p>My Controller:</p>
  
  <pre><code> def new
      @survey = Survey.new
      survey_section = @survey.survey_sections.build
      survey_section.questions.build
    end
  
   def create
      @survey = Survey.new(survey_params)
      if @survey.save
        redirect_to @survey, notice: 'Super'
      else
        render 'new'
      end
    end
  
   def survey_params
        params.require(:survey).permit(:title, :description, survey_sections_attributes:[:id, :title, questions_attributes:[:id, :text, answers_attributes:[:id, :text]]])
      end
  </code></pre>
  
  <p>How it is possible to save data in more then 3 models? 
  At the moment i can save from my survey form data into the survey, survey section and question model. But i don't know what i have to in the controller that i can save data into the other models.</p>