diff options
author | Rick Olson <technoweenie@gmail.com> | 2007-11-11 01:03:43 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2007-11-11 01:03:43 +0000 |
commit | 3104291322b4f1834d342eef740c23427f36384d (patch) | |
tree | 30710723e999f8f12eed95ea85803a5de3597320 /activerecord/lib/active_record/associations/has_many_through_association.rb | |
parent | 49cb41270ae8db886987b8a3762d8e512d646ffa (diff) | |
download | rails-3104291322b4f1834d342eef740c23427f36384d.tar.gz rails-3104291322b4f1834d342eef740c23427f36384d.tar.bz2 rails-3104291322b4f1834d342eef740c23427f36384d.zip |
Fix HasManyThrough Association so it uses :conditions on the HasMany Association. Closes #9729 [danger]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8128 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/associations/has_many_through_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_through_association.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb index 5ff0e3d0d7..8bff88e839 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -262,8 +262,9 @@ module ActiveRecord @conditions ||= [ (interpolate_sql(@reflection.klass.send(:sanitize_sql, @reflection.options[:conditions])) if @reflection.options[:conditions]), (interpolate_sql(@reflection.active_record.send(:sanitize_sql, @reflection.through_reflection.options[:conditions])) if @reflection.through_reflection.options[:conditions]), + (interpolate_sql(@reflection.active_record.send(:sanitize_sql, @reflection.source_reflection.options[:conditions])) if @reflection.source_reflection.options[:conditions]), ("#{@reflection.through_reflection.table_name}.#{@reflection.through_reflection.klass.inheritance_column} = #{@reflection.klass.quote_value(@reflection.through_reflection.klass.name.demodulize)}" unless @reflection.through_reflection.klass.descends_from_active_record?) - ].compact.collect { |condition| "(#{condition})" }.join(' AND ') unless (!@reflection.options[:conditions] && !@reflection.through_reflection.options[:conditions] && @reflection.through_reflection.klass.descends_from_active_record?) + ].compact.collect { |condition| "(#{condition})" }.join(' AND ') unless (!@reflection.options[:conditions] && !@reflection.through_reflection.options[:conditions] && !@reflection.source_reflection.options[:conditions] && @reflection.through_reflection.klass.descends_from_active_record?) end alias_method :sql_conditions, :conditions |