Displaying 1 result from an estimated 1 matches for "requisite_for".
2006 Apr 05
4
Self-referential join creation/deletion and :through
...: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 want to create the "requisite" relationship between the
two records, this seems to work properly:
course = Course.find_by_name("Econ...