You want a join model. I would call it "CoursesYear" because then you don't need to change your table name, but you can also move all that data to another model if you like. Your models will be setup like this:
class Courses < ActiveRecord::Base
has_many :courses_years
has_many :years, :through => :courses_years
end
class Years < ActiveRecord::Base
has_many :courses_years
has_many :courses, :through => :courses_years
end
class CoursesYears < ActiveRecord::Base
belongs_to :course
belongs_to :year
end
Whenever you need the attributes (compulsory in this case) you normally access it through the join model. If you want to just find all courses which are compulsory for a given year, the question is answered here.