diff options
author | Rick Olson <technoweenie@gmail.com> | 2006-07-24 04:55:16 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2006-07-24 04:55:16 +0000 |
commit | 971e03f24e1121a2fe03beab23b0370a64fcfc37 (patch) | |
tree | e7c5df3357054e5a30d0b71d616036f5abe0ac86 /activerecord/lib/active_record | |
parent | 04d9e94e88be0ba076b0fef980e8bde8e25061d9 (diff) | |
download | rails-971e03f24e1121a2fe03beab23b0370a64fcfc37.tar.gz rails-971e03f24e1121a2fe03beab23b0370a64fcfc37.tar.bz2 rails-971e03f24e1121a2fe03beab23b0370a64fcfc37.zip |
Allow #count through a has_many association to accept :include. [Dan Peterson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4618 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 1 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 1 |
2 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 5eb6495b9d..192c7b7a5f 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -17,7 +17,6 @@ module ActiveRecord class HasManyThroughAssociationPolymorphicError < ActiveRecordError #:nodoc: def initialize(owner_class_name, reflection, source_reflection) - source_reflection = source_reflection super("Cannot have a has_many :through association '#{owner_class_name}##{reflection.name}' on the polymorphic object '#{source_reflection.class_name}##{source_reflection.name}'.") end end diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index d00ac96540..e79fa858c4 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -48,6 +48,7 @@ module ActiveRecord options[:conditions] = options[:conditions].nil? ? @finder_sql : @finder_sql + " AND (#{sanitize_sql(options[:conditions])})" + options[:include] = @reflection.options[:include] @reflection.klass.count(column_name, options) end |