title: Looking for a way to track history in rails database
body: <p>I'm considering this an add-on question of sorts to the thread below:
  <a href="https://stackoverflow.com/questions/7606124/using-join-tables-in-ruby-on-rails">Using join tables in ruby on rails</a></p>
  
  <p>So we have 'Student' and 'Course' scaffolds joined by a many-to-many association, but in addition there is also a 'Semester' scaffold and what I wish to do is, for each student that is added to a course, for the application to search for previous iterations of the same course through past semesters, to that it's known how many times a student has taken that class before. I'm kind of mixed up at the moment as to how to implement this, so I was hoping someone could help me pin down the logic and code I should be operating by.</p>
  
  <p>Some underlying assumptions I have so far:</p>
  
  <ul>
  <li>'Course' and 'Semester' should, like 'Student' and 'Course', be joined
  by a many-to-many association (many courses are taught per semester,
  and a course is taught for more than one semester).</li>
  <li>There should be an action (let's say get_student) within the course
  controller to locate the student via student_id. <strong>This would be the main area I'm scratching my head as to what to do. What would this method look like in code?</strong></li>
  <li>Within the student-course join table I should have an attribute
  'attempts' which increments each time get_student finds this
  student_id combined with the course_id that calls the method.This
  would be the mechanism that actually tells how many times the course
  had been attempted by the student.</li>
  <li>I initially wondered if there should be a 'semester' controller
  action to activate get_student across all semesters, but now I'm
  thinking that get_student should work fine without that.</li>
  </ul>
  
  <p>Appreciate any help I can get on this. Thanks.</p>