Oops.... posted that before I was finished with it.... Here are the classes:
class A < ActiveRecord::Base has_one :b, :foreign_key=>:a_id, :conditions=>[...], :dependent=>:destroy has_one :c, :foreign_key=>:a_id, :conditions=>[...], :source=>:c, :through=>:b, :class_name=>'C' end class B < ActiveRecord::Base belongs_to :a, :foreign_key=>:a_id belongs_to :c, :foreign_key=>:c_id end class C < ActiveRecord::Base has_one :b, :foreign_key=>:c_id has_one :a, :foreign_key=>:c_id, :through=>:b, :class_name=>'A', :source=>:a end On Jan 1, 2:54 pm, mikelb <[email protected]> wrote: > Hey, all, > > I just wanted to put it out here that I have had success with > has_one :through, and I just want to document what I did in case > others need help. > > let's assume the following models: > A -> B <- C > > class A < ActiveRecord::Base > > has_one :b, :foreign_key=>:a_id, :conditions=>[...], :dependent=>:destroy > > has_one :c, :foreign_key=>:a_id, :conditions=>[...], :source=>:c, > :through=>:b, :class_name=>'C' > end > > class B < ActiveRecord::Base > > end -- You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.
