Displaying 1 result from an estimated 1 matches for "courses_requiring".
2006 Apr 05
4
Self-referential join creation/deletion and :through
...''
end
class Course < ActiveRecord::Base
has_many :requisite_courses, :class_name => ''CourseRequisite'',
:foreign_key => ''course_id''
has_many :requisites, :through => :requisite_courses, :source =>
:requisite
has_many :courses_requiring, :class_name => ''CourseRequisite'',
:foreign_key => ''requisite_id''
has_many :requisite_for, :through => :courses_requiring, :source =>
:course
end
Now, assuming that records for two courses already have been created,
and we simply wa...