title: Rails 4 Attendance system
body: <p>Hi I'm actually struggling with building a Rails 4 application implementing an attendance model on rails 4, I found maybe two question on stackoverflow but they're posted in 2012 and it failed when i tried following them.</p>
  
  <p>This is the closest one i got <a href="https://stackoverflow.com/questions/11991892/rails-3-taking-attendance-form-how-to-create-multiple-records">on stackoverflow</a></p>
  
  <p>Edit: I already have a view of classroom and list out the students. And could assign students into the classroom but the problem would be to GET the students into a new <strong>attsheet</strong> and saving them into <strong>attendance</strong></p>
  
  <p>Here's what I currently have now</p>
  
  <pre><code># Attendance
  # take student as a single entry for :attsheet and
  # has a :attended (boolean) and remarks as well
  class Attendance &lt; ActiveRecord::Base
    belongs_to :student
    belongs_to :attsheet
  end    
  
  #Attsheet which means attendance sheet
  #has :post_date and :remark 
  class Attsheet &lt; ActiveRecord::Base
    belongs_to :classroom
    has_many :attendances
    accepts_nested_attributes_for :attendances 
  end
  
  class Student &lt; ActiveRecord::Base
    belongs_to :school
    has_and_belongs_to_many :classrooms
    has_many :attendances
  end
  
  class Classroom &lt; ActiveRecord::Base
    belongs_to :school
    has_and_belongs_to_many :students
    has_many :attsheets
  
    validates :class_name, presence: true
  end
  </code></pre>
  
  <p>I want the classroom to be able to create a new attendance or view attendance archives for each student.</p>
  
  <p>I am able to do this in classroom right now but I'm stuck at what to do next for the controller and view</p>
  
  <pre><code> $ = link_to "New Attendance", new_school_classroom_attsheet_path(@school, @classroom, @attsheet) 
  </code></pre>