aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-06-06 03:54:16 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-06-06 03:54:16 -0700
commitfd40fbc1983a96587cc25729985191573a03e04c (patch)
tree5512aeee7861ae872ad5f9e5b84fedc82b1923b0 /activerecord
parent566d717d783f56563cd602198be2177c972c9a81 (diff)
downloadrails-fd40fbc1983a96587cc25729985191573a03e04c.tar.gz
rails-fd40fbc1983a96587cc25729985191573a03e04c.tar.bz2
rails-fd40fbc1983a96587cc25729985191573a03e04c.zip
Generate less garbage when expanding range bind variables in conditions
Diffstat (limited to 'activerecord')
-rwxr-xr-xactiverecord/lib/active_record/base.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 8dd07eb478..110902b590 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -2064,13 +2064,18 @@ module ActiveRecord #: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: