Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Fix hash conditions sanitizing of end-exclusive (...) ranges

#1865

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.

Reported by Will Bryant · February 4th, 2009 @ 12:13 AM

State: committed
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Repository
    Repository
    • 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 Fix hash conditions sanitizing of end-exclusive (...) ranges state:committed] http://github.com/rails/rails/co...

    February 6th, 2009 @ 12:48 AM