diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-05-29 10:20:39 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-05-29 10:20:39 +0100 |
commit | abb1bd2efa43b8efbb3faf4ccfb9246704a9044c (patch) | |
tree | 197406a437a6f16de276979f983e499e4a448bf7 /activerecord/lib | |
parent | 4d248543429918bc5a63e109e6f2327ffab9848b (diff) | |
download | rails-abb1bd2efa43b8efbb3faf4ccfb9246704a9044c.tar.gz rails-abb1bd2efa43b8efbb3faf4ccfb9246704a9044c.tar.bz2 rails-abb1bd2efa43b8efbb3faf4ccfb9246704a9044c.zip |
Ensure AssociationCollection#count works with empty condition. [#271 state:resolved] [Jan De Poorter]
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 963a938485..f584a97cbb 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -9,7 +9,7 @@ module ActiveRecord @reflection.klass.count_by_sql(@finder_sql) else column_name, options = @reflection.klass.send(:construct_count_options_from_args, *args) - options[:conditions] = options[:conditions].nil? ? + options[:conditions] = options[:conditions].blank? ? @finder_sql : @finder_sql + " AND (#{sanitize_sql(options[:conditions])})" options[:include] ||= @reflection.options[:include] |