aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-09-08 16:53:17 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-09-08 16:53:17 -0700
commitb4fdfcf6ad4ed7a98eb27a5c416c460a805c1355 (patch)
treeb3091e3af4e42dde5497ac9feafd7282f2d8792e /activerecord
parent588db0fa8f0e7858a95408b0be1fc658c114f7b9 (diff)
downloadrails-b4fdfcf6ad4ed7a98eb27a5c416c460a805c1355.tar.gz
rails-b4fdfcf6ad4ed7a98eb27a5c416c460a805c1355.tar.bz2
rails-b4fdfcf6ad4ed7a98eb27a5c416c460a805c1355.zip
returning arrays lets us avoid Array.wrap
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index c89dd0aec7..b337606f84 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -75,7 +75,7 @@ module ActiveRecord
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 @@ module ActiveRecord
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 @@ module ActiveRecord
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