aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2016-09-19 12:02:35 -0300
committerGitHub <noreply@github.com>2016-09-19 12:02:35 -0300
commitc66121722b0a39b5090b5e4bad88a3590e88d076 (patch)
tree588ed4b3edce8d65a25cd1bdd5264cffd75831e0 /activerecord
parent22896756580dfe6616c99880154bbe13119401a6 (diff)
parentf45e08e524d63c54e2db8fa91fb739d676d58707 (diff)
downloadrails-c66121722b0a39b5090b5e4bad88a3590e88d076.tar.gz
rails-c66121722b0a39b5090b5e4bad88a3590e88d076.tar.bz2
rails-c66121722b0a39b5090b5e4bad88a3590e88d076.zip
Merge pull request #26447 from kamipo/reduce_array_allocation
Reduce array allocation when `where` with passed hash
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/relation/where_clause_factory.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/where_clause_factory.rb b/activerecord/lib/active_record/relation/where_clause_factory.rb
index dc00149130..1e7deeffad 100644
--- a/activerecord/lib/active_record/relation/where_clause_factory.rb
+++ b/activerecord/lib/active_record/relation/where_clause_factory.rb
@@ -7,8 +7,6 @@ module ActiveRecord
end
def build(opts, other)
- binds = []
-
case opts
when String, Array
parts = [klass.send(:sanitize_sql, other.empty? ? opts : ([opts] + other))]
@@ -26,7 +24,7 @@ module ActiveRecord
raise ArgumentError, "Unsupported argument type: #{opts} (#{opts.class})"
end
- WhereClause.new(parts, binds)
+ WhereClause.new(parts, binds || [])
end
protected