def construct_count_options_from_legacy_args(*args)
options = {}
column_name = :all
if args.size > 2
raise ArgumentError, "Unexpected parameters passed to count(options={}): #{args.inspect}"
elsif args.size > 0
if args[0].is_a?(Hash)
options = args[0]
elsif args[1].is_a?(Hash)
column_name, options = args
else
ActiveSupport::Deprecation.warn(
"You called count(#{args[0].inspect}, #{args[1].inspect}), which is a deprecated API call. " +
"Instead you should use count(column_name, options). Passing the conditions and joins as " +
"string parameters will be removed in Rails 2.0.", caller(2)
)
options.merge!(:conditions => args[0])
options.merge!(:joins => args[1]) if args[1]
end
end
[column_name, options]
end