Displaying 1 result from an estimated 1 matches for "disciplinerecord".
Did you mean:
discipline_records
2006 Apr 20
3
has_many :through with has_many/has_many join models
...39;'s will
fail to generate proper SQL
class StudentSemesterRecord < ActiveRecord::Base
belongs_to :semester
has_many :discipline_records, :through => :semester
end
class Semester < ActiveRecord::Base
has_many :student_semester_records
has_many :discipline_records
end
class DisciplineRecord < ActiveRecord::Base
belongs_to :semester
end
student_semester_record.discipline_records yields this SQL:
SELECT discipline_records.* FROM discipline_records INNER JOIN semesters
ON discipline_records.semester_id = semesters.id WHERE
(semesters.semester_id = 1349)
The where clause is inval...