diff options
Diffstat (limited to 'activerecord/lib/active_record/calculations.rb')
-rw-r--r-- | activerecord/lib/active_record/calculations.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index af976f532f..774926f409 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -61,7 +61,7 @@ module ActiveRecord raise(ArgumentError, "Unexpected parameters passed to count(*args): expected either count(conditions=nil, joins=nil) or count(options={})") end - options[:include] ? count_with_associations(options) : calculate(:count, :all, options) + (scope(:find, :include) || options[:include]) ? count_with_associations(options) : calculate(:count, :all, options) end # Calculates average value on a given column. The value is returned as a float. See #calculate for examples with options. @@ -221,4 +221,4 @@ module ActiveRecord end end end -end
\ No newline at end of file +end |