Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix indentation

  • Loading branch information...
commit f195e076fe537afae76f51c1264d0a47f3df4073 1 parent d803344
@neerajdotname neerajdotname authored
Showing with 14 additions and 14 deletions.
  1. +14 −14 activerecord/lib/active_record/associations/collection_association.rb
View
28 activerecord/lib/active_record/associations/collection_association.rb
@@ -200,23 +200,23 @@ def destroy_all
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
Please sign in to comment.
Something went wrong with that request. Please try again.