Skip to content
Browse files

Used ActiveRecord's expand_range_bind_variables for range scope argum…

…ents.

Signed-off-by: Ben Johnson <bjohnson@binarylogic.com>
  • Loading branch information...
1 parent 22c6d42 commit d3ea7de85762c2419e4921d1e364c66f56dad780 laserlemon committed with Aug 19, 2009
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/searchlogic/named_scopes/conditions.rb
View
10 lib/searchlogic/named_scopes/conditions.rb
@@ -154,15 +154,15 @@ def scope_options(condition, column_type, sql, value_modifier = nil)
join = $1 == "any" ? " OR " : " AND "
scope_sql = values.collect { |value| sql.is_a?(Proc) ? sql.call(value) : sql }.join(join)
- {:conditions => [scope_sql, *values]}
+ {:conditions => [scope_sql, *expand_range_bind_variables(values)]}
}
else
- searchlogic_lambda(column_type) { |value|
- value = value_with_modifier(value, value_modifier)
+ searchlogic_lambda(column_type) { |*values|
+ values.collect! { |value| value_with_modifier(value, value_modifier) }
- scope_sql = sql.is_a?(Proc) ? sql.call(value) : sql
+ scope_sql = sql.is_a?(Proc) ? sql.call(*values) : sql
- {:conditions => [scope_sql, value]}
+ {:conditions => [scope_sql, *expand_range_bind_variables(values)]}
}
end
end

0 comments on commit d3ea7de

Please sign in to comment.
Something went wrong with that request. Please try again.