Add extra data to the join table - Rails
ruby-on-rails
Solution
Switch to using a `:has_many => :through` association, which is specifically designed for when you need a join model. There are more details in the ActiveRecord Associations Rails Guide.
Problem
I am developing an application, with a years model and a courses model. Currently there is a has_and_belongs_to_many relationship linking these with a courses_years table, however I would like to store an extra field in the courses_years table. The new field is a boolean value called "compulsory". Is there an easy or nice way of doing this?