Displaying 1 result from an estimated 1 matches for "related_as".
2011 Jan 15
3
has_many :through with Single Table inheritance
I have the following model structure setup.
class User < ActiveRecord::Base
end
class Parent < User
has_many :relationships
has_many :children,
:class_name => "Student",
:through => :relationships,
:conditions => "related_as = ''parent''"
end
class Student < User
has_many :relationships
has_many :parents,
:through => :relationships,
:conditions => "related_as = ''child''"
end
class Relationship < ActiveRecord::Base
belo...