On Mon, Jan 5, 2009 at 6:14 PM, itsastickup <[email protected]> wrote: > My models look like this : > > class Person < ActiveRecord::Base > > has_many :vassalships,:class_name=>'Vassalship',:foreign_key=>:master_id > has_one :master,:through=>:vassalships,:source=>:master; > has_many :servants,:through=>:vassalships,:source=>:servant; > end > > class Vassalship < ActiveRecord::Base > belongs_to :master,:class_name=>'Person',:foreign_key=>'master_id' > belongs_to :servant,:class_name=>'Person',:foreign_key=>'servant_id' > end
You only need one model, Person should suffice: class Person < ActiveRecord::Base belongs_to :master, :class_name => 'Person', :foreign_key => 'master_id' has_many :servants, :class_name => 'Person', :foreign_key => 'master_id' end Let me know how you get on. Regards, Franz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

