Permalink
Browse files

returning arrays lets us avoid Array.wrap

  • Loading branch information...
1 parent ad781a1 commit 662ce52ed79e7b96b79230cf945ffadff433e43f @tenderlove tenderlove committed Sep 8, 2010
Showing with 4 additions and 4 deletions.
  1. +4 −4 activerecord/lib/active_record/relation/query_methods.rb
@@ -75,7 +75,7 @@ def where(opts, *rest)
relation = clone
if opts.present?
- relation.where_values += Array.wrap(build_where(opts, rest))
+ relation.where_values += build_where(opts, rest)
end
relation
@@ -85,7 +85,7 @@ def having(*args)
relation = clone
if args.present?
- relation.having_values += Array.wrap(build_where(*args))
+ relation.having_values += build_where(*args)
end
relation
@@ -216,12 +216,12 @@ def build_arel
def build_where(opts, other = [])
case opts
when String, Array
- @klass.send(:sanitize_sql, other.empty? ? opts : ([opts] + other))
+ [@klass.send(:sanitize_sql, other.empty? ? opts : ([opts] + other))]
when Hash
attributes = @klass.send(:expand_hash_conditions_for_aggregates, opts)
PredicateBuilder.new(table.engine).build_from_hash(attributes, table)
else
- opts
+ [opts]
end
end

0 comments on commit 662ce52

Please sign in to comment.