This project is archived and is in readonly mode.

#1865 ✓committed
Will Bryant

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

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

Attachments

Referenced by

Pages