[Rails] Re: newbie trying self-referencing :through via REST model

2009-01-07 Thread Andrius Chamentauskas
try: class Person < ActiveRecord::Base has_many :vassalships,:class_name=>'Vassalship',:foreign_key=>'master_id' has_many :vassalship_belongings, :class_name => 'Vassalship', :foreign_key => 'slave_id' has_one :master,:through=>:vassalships,:source=>:person has_many :servants

[Rails] Re: newbie trying self-referencing :through via REST model

2009-01-06 Thread itsastickup
I have a need for REST (as well as other things), as mentioned, and for that I require the go-between model. In anycase presumably my original question does have an answer, no? Perhaps :through does not work self-referentially, although I would be surprised. But the docs don;t have it and blogs h

[Rails] Re: newbie trying self-referencing :through via REST model

2009-01-05 Thread Franz Strebel
On Mon, Jan 5, 2009 at 6:14 PM, itsastickup 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