I have:
class Student < ActiveRecord::Base
#attr_accessible :lastname, :name
has_many :together
has_many :teachers, :through => :together
end
class Teacher < ActiveRecord::Base
#attr_accessible :lastname, :name
has_many :together
has_many :students, :through => :together
end
class Together < ActiveRecord::Base
#attr_accessible :summary
belongs_to :student
belongs_to :teacher
end
I wanna do something like:
Student.find(1).together.summary
I want to access the data in the “summary” column, in the join table…
If you’re just trying to get the children you can do:
If your teachers model has a summary field, you could do something like this:
I guess if you have a summary field in the join table and you know the student id you could so this:
There’s other ways to do this. A few ways to skin a Rails cat.