aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2013-07-02 22:01:35 +0530
committerNeeraj Singh <neerajdotname@gmail.com>2013-07-02 22:08:42 +0530
commitf195e076fe537afae76f51c1264d0a47f3df4073 (patch)
treee86e290a94b0d372d57504bf766222773cf1250d /activerecord/lib/active_record/associations
parentd80334488ff5c83e63cca3fb70250e9002a2f0c3 (diff)
downloadrails-f195e076fe537afae76f51c1264d0a47f3df4073.tar.gz
rails-f195e076fe537afae76f51c1264d0a47f3df4073.tar.bz2
rails-f195e076fe537afae76f51c1264d0a47f3df4073.zip
fix indentation
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/collection_association.rb28
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