aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/post.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-19 00:27:40 +0100
committerJon Leighton <j@jonathanleighton.com>2010-10-19 00:27:40 +0100
commit9ec07348749675110843c44f680da79223218db2 (patch)
treee4a356d2b6ee95232097fac21df5a04118dcc014 /activerecord/test/models/post.rb
parent78b8c51cb3b0c629152f3bbaf6d8bcf988cc936e (diff)
downloadrails-9ec07348749675110843c44f680da79223218db2.tar.gz
rails-9ec07348749675110843c44f680da79223218db2.tar.bz2
rails-9ec07348749675110843c44f680da79223218db2.zip
Properly support conditions on any of the reflections involved in a nested through association
Diffstat (limited to 'activerecord/test/models/post.rb')
-rw-r--r--activerecord/test/models/post.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index f3b78c3647..281586b438 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -64,6 +64,11 @@ class Post < ActiveRecord::Base
has_many :funky_tags, :through => :taggings, :source => :tag
has_many :super_tags, :through => :taggings
has_one :tagging, :as => :taggable
+
+ has_many :first_taggings, :as => :taggable, :class_name => 'Tagging', :conditions => "taggings.comment = 'first'"
+ has_many :first_blue_tags, :through => :first_taggings, :source => :tag, :conditions => "tags.name = 'Blue'"
+
+ has_many :first_blue_tags_2, :through => :taggings, :source => :blue_tag, :conditions => "taggings.comment = 'first'"
has_many :invalid_taggings, :as => :taggable, :class_name => "Tagging", :conditions => 'taggings.id < 0'
has_many :invalid_tags, :through => :invalid_taggings, :source => :tag