diff options
author | Jon Leighton <j@jonathanleighton.com> | 2010-10-09 22:00:33 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2010-10-09 22:00:33 +0100 |
commit | ab5a9335020eff0da35b62b86a62ed8587a4d598 (patch) | |
tree | 1a1996c8844e359b88d5b30bf3531d22dba83d1b /activerecord/test/models/person.rb | |
parent | c954d54e2f36bb53ced5e3655adc071dd233797e (diff) | |
download | rails-ab5a9335020eff0da35b62b86a62ed8587a4d598.tar.gz rails-ab5a9335020eff0da35b62b86a62ed8587a4d598.tar.bz2 rails-ab5a9335020eff0da35b62b86a62ed8587a4d598.zip |
Add support for nested through associations in JoinAssociation. Hence Foo.joins(:bar) will work for through associations. There is some duplicated code now, which will be refactored.
Diffstat (limited to 'activerecord/test/models/person.rb')
-rw-r--r-- | activerecord/test/models/person.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/test/models/person.rb b/activerecord/test/models/person.rb index 951ec93c53..d35c51b660 100644 --- a/activerecord/test/models/person.rb +++ b/activerecord/test/models/person.rb @@ -13,6 +13,9 @@ class Person < ActiveRecord::Base belongs_to :primary_contact, :class_name => 'Person' has_many :agents, :class_name => 'Person', :foreign_key => 'primary_contact_id' belongs_to :number1_fan, :class_name => 'Person' + + has_many :agents_posts, :through => :agents, :source => :posts + has_many :agents_posts_authors, :through => :agents_posts, :source => :author scope :males, :conditions => { :gender => 'M' } scope :females, :conditions => { :gender => 'F' } |