This project is archived and is in readonly mode.
Fix hash conditions sanitizing of end-exclusive (...) ranges
Reported by Will Bryant | February 4th, 2009 @ 12:13 AM | in 2.x
Currently, :conditions => {:foo => 2.0..3.0} and :conditions => {:foo => 2.0...3.0} both sanitize to "foo BETWEEN 2.0 AND 3.0", which is incorrect - Ruby's Range object is defined to exclude the end value when you use ... to create the range, so we need to output "foo >= 2.0 AND foo < 3.0" in this #exclude_end? case.
The attached patch fixes this behavior. I made a small refactor to the two calls to attribute_condition to support passing along the (quoted) attribute name so that it can be mentioned more than once.
Comments and changes to this ticket
-
Repository February 6th, 2009 @ 12:48 AM
- State changed from new to committed
(from [9991868d85b25da672bf119bfcbff22a4bb6e8f1]) support end-exclusive ... Ranges in SQL hash condition sanitization properly
Signed-off-by: Michael Koziarski michael@koziarski.com [#1865 state:committed] http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
- Nobody is watching this ticket.
Attachments
Tags
Referenced by
- 1865 Fix hash conditions sanitizing of end-exclusive (...) ranges Signed-off-by: Michael Koziarski michael@koziarski.com [#...