title: undefined method `students' for #<Period:0x007fb7fff47360>
body: <p>I'm trying to add students I created in a school, to a teachers period (class).  I'm not looking to create a new student in a period, but rather select students from a list I created in the school.  I was able to list the students in a period, but cannot add them to the period.  I'm unsure if I use the build method or something different.  I'm currently getting an undefined method error and am just unsure which way to go from here.  </p>
  
  <pre><code>&lt;p id="notice"&gt;&lt;%= notice %&gt;&lt;/p&gt;
  
  &lt;p&gt;
    &lt;strong&gt;Class Name:&lt;/strong&gt;
     &lt;%= @period.period %&gt;
  
      &lt;/p&gt;
  
  &lt;%= link_to 'Delete Period', [@period.teacher, @period],
             method: :delete,
             data: { confirm: 'Are you sure?' } %&gt;
  
  
  
   &lt;h2&gt;Add a student to period&lt;/h2&gt;
   &lt;%= form_for([@period, @period.students.build]) do |f| %&gt;
  
    &lt;p&gt;
      &lt;%= check_box_tag "school[student_ids][]", student.id %&gt;
      &lt;%= link_to student.name, edit_school_student_path(@school, student) %&gt;
    &lt;/p&gt;
  
  &lt;p&gt;
  &lt;%= f.submit %&gt;
  &lt;/p&gt;
  &lt;% end %&gt;
  
  
  class Period &lt; ActiveRecord::Base
    belongs_to :teacher
    has_many :students
  end
  
  class Student &lt; ActiveRecord::Base
    belongs_to :school
    has_many :teachers, through: :periods
  end
  
  class Teacher &lt; ActiveRecord::Base
    belongs_to :school
    has_many :periods
    has_many :students, through: :periods 
  end
  
  class School &lt; ActiveRecord::Base
      has_many :teachers, dependent: :destroy
      has_many :students, dependent: :destroy
      has_many :schoolads, dependent: :destroy
  end
  </code></pre>