Displaying 2 results from an estimated 2 matches for "semester_id".
2006 Apr 20
3
has_many :through with has_many/has_many join models
...s_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 invalid. It is using:
semesters.semester_id = #{student_semester_record.id}
It should be using:
semesters.id = #{student_semester_record.semester_id}
Am I doing something wrong, is this a bug, or is this association type
s...
2009 Mar 06
9
Association broken when upgrading from rails 1.2.6 to 2.2.2
I have an app with the following models:
course
belongs_to :semester
semester
has_many: courses
belongs_to :education
education
has_many :semesters
In my old app (rails 1.2.6) I was able to access variables via
controller
@courses = Course.find(:all)
view file:
<% for course in @courses %>
<%= course.name %> <- this line works
<%= course.semester.name %> <- this is now