instance method
construct_count_options_from_args
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
construct_count_options_from_args(*args)
No documentation comment.
Parameters
-
argsrest
Source
# File activerecord/lib/active_record/calculations.rb, line 133
def construct_count_options_from_args(*args)
options = {}
column_name = :all
# We need to handle
# count()
# count(:column_name=:all)
# count(options={})
# count(column_name=:all, options={})
case args.size
when 1
args[0].is_a?(Hash) ? options = args[0] : column_name = args[0]
when 2
column_name, options = args
else
raise ArgumentError, "Unexpected parameters passed to count(): #{args.inspect}"
end if args.size > 0
[column_name, options]
end
Defined in activerecord/lib/active_record/calculations.rb line 133
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Calculations::ClassMethods