title: Rollback when creating object with nested attributes
body: <p>I have these models and I am using cocoon with nested_attributes:</p>
  
  <p>models/report.rb:</p>
  
  <pre><code>class Report &lt; ApplicationRecord
    has_many :option_students
  
    accepts_nested_attributes_for :option_students, allow_destroy: true
  end
  </code></pre>
  
  <p>models/option_students.rb:</p>
  
  <pre><code>class OptionStudent &lt; ApplicationRecord
    belongs_to :student
    belongs_to :option
    belongs_to :report
  end
  </code></pre>
  
  <p>I am trying to create a report using rails console. I already have a student and a option saved on DB.</p>
  
  <p>If I write:</p>
  
  <pre><code>Report.create(option_students_attributes: [{student_id: 1, option_id: 1}])
  </code></pre>
  
  <p>The console outputs a rollback:</p>
  
  <pre><code>(0.2ms)  BEGIN
    Student Load (0.2ms)  SELECT  "students".* FROM "students" WHERE "students"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
    Option Load (0.1ms)  SELECT  "options".* FROM "options" WHERE "options"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
     (0.2ms)  ROLLBACK
  </code></pre>
  
  <p>It does not create the report nor the option_student object.</p>
  
  <p>But if I just type <code>Report.create</code> and then I write </p>
  
  <pre><code>Report.update(1, option_students_attributes: [{student_id: 1, option_id: 1}])
  </code></pre>
  
  <p>It successfully creates the option student when updating the report. What I am doing wrong with this? I just used nested attributes with other models and it worked.</p>