diff options
author | Vipul A M <vipulnsward@gmail.com> | 2013-10-13 21:27:21 +0530 |
---|---|---|
committer | Vipul A M <vipulnsward@gmail.com> | 2013-10-13 21:27:21 +0530 |
commit | 4ce643dbb5bd37e1f4662b37abc80a18078feba1 (patch) | |
tree | 87fd3541b7c2904337b6275d87d597307d7c8954 /activerecord/lib | |
parent | 0df9149fd6b0ef4cd9003c1a9c406e2c586c9503 (diff) | |
download | rails-4ce643dbb5bd37e1f4662b37abc80a18078feba1.tar.gz rails-4ce643dbb5bd37e1f4662b37abc80a18078feba1.tar.bz2 rails-4ce643dbb5bd37e1f4662b37abc80a18078feba1.zip |
`Relation#count` doesn't use options anymore.
Diffstat (limited to 'activerecord/lib')
3 files changed, 5 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index 75f8990cf0..6b06a5f7fd 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -195,9 +195,7 @@ module ActiveRecord # Count all records using SQL. Construct options and pass them with # scope to the target class's +count+. - def count(column_name = nil, count_options = {}) - column_name, count_options = nil, column_name if column_name.is_a?(Hash) - + def count(column_name = nil) relation = scope if association_scope.distinct_value # This is needed because 'SELECT count(DISTINCT *)..' is not valid SQL. diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb index ea7f768a68..0b6cdf5217 100644 --- a/activerecord/lib/active_record/associations/collection_proxy.rb +++ b/activerecord/lib/active_record/associations/collection_proxy.rb @@ -669,8 +669,8 @@ module ActiveRecord # # #<Pet id: 2, name: "Spook", person_id: 1>, # # #<Pet id: 3, name: "Choo-Choo", person_id: 1> # # ] - def count(column_name = nil, options = {}) - @association.count(column_name, options) + def count(column_name = nil) + @association.count(column_name) end # Returns the size of the collection. If the collection hasn't been loaded, diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 27c04b0952..a4fe3bd3b7 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -19,9 +19,8 @@ module ActiveRecord # # Person.group(:city).count # # => { 'Rome' => 5, 'Paris' => 3 } - def count(column_name = nil, options = {}) - column_name, options = nil, column_name if column_name.is_a?(Hash) - calculate(:count, column_name, options) + def count(column_name = nil) + calculate(:count, column_name) end # Calculates the average value on a given column. Returns +nil+ if there's |