diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2013-07-02 22:01:35 +0530 |
---|---|---|
committer | Neeraj Singh <neerajdotname@gmail.com> | 2013-07-02 22:08:42 +0530 |
commit | f195e076fe537afae76f51c1264d0a47f3df4073 (patch) | |
tree | e86e290a94b0d372d57504bf766222773cf1250d /activerecord | |
parent | d80334488ff5c83e63cca3fb70250e9002a2f0c3 (diff) | |
download | rails-f195e076fe537afae76f51c1264d0a47f3df4073.tar.gz rails-f195e076fe537afae76f51c1264d0a47f3df4073.tar.bz2 rails-f195e076fe537afae76f51c1264d0a47f3df4073.zip |
fix indentation
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations/collection_association.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index 5bcd31cca0..6ddbd4955d 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -200,23 +200,23 @@ module ActiveRecord def count(column_name = nil, count_options = {}) column_name, count_options = nil, column_name if column_name.is_a?(Hash) - relation = scope - if association_scope.distinct_value - # This is needed because 'SELECT count(DISTINCT *)..' is not valid SQL. - column_name ||= reflection.klass.primary_key - relation = relation.distinct - end + relation = scope + if association_scope.distinct_value + # This is needed because 'SELECT count(DISTINCT *)..' is not valid SQL. + column_name ||= reflection.klass.primary_key + relation = relation.distinct + end - value = relation.count(column_name) + value = relation.count(column_name) - limit = options[:limit] - offset = options[:offset] + limit = options[:limit] + offset = options[:offset] - if limit || offset - [ [value - offset.to_i, 0].max, limit.to_i ].min - else - value - end + if limit || offset + [ [value - offset.to_i, 0].max, limit.to_i ].min + else + value + end end # Removes +records+ from this association calling +before_remove+ and |