Permalink
Browse files

Generate less garbage when expanding range bind variables in conditions

  • Loading branch information...
jeremy committed Jun 6, 2008
1 parent 566d717 commit fd40fbc1983a96587cc25729985191573a03e04c
Showing with 8 additions and 3 deletions.
  1. +8 −3 activerecord/lib/active_record/base.rb
@@ -2064,13 +2064,18 @@ def replace_named_bind_variables(statement, bind_vars) #:nodoc:
end
def expand_range_bind_variables(bind_vars) #:nodoc:
- bind_vars.sum do |var|
+ expanded = []
+
+ bind_vars.each do |var|
if var.is_a?(Range)
- [var.first, var.last]
+ expanded << var.first
+ expanded << var.last
else
- [var]
+ expanded << var
end
end
+
+ expanded
end
def quote_bound_value(value) #:nodoc:

0 comments on commit fd40fbc

Please sign in to comment.