From 9ec07348749675110843c44f680da79223218db2 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Tue, 19 Oct 2010 00:27:40 +0100 Subject: Properly support conditions on any of the reflections involved in a nested through association --- activerecord/test/models/post.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activerecord/test/models/post.rb') 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 -- cgit v1.2.3