This project is archived and is in readonly mode.
Use cover? for validates_inclusion_of with Ranges on 1.9
Reported by Frederick Cheung | February 18th, 2011 @ 06:01 PM | in 3.x
Range#include? behaves differently on 1.9 than on 1.8 ( http://rhnh.net/2009/08/03/range-include-in-ruby-1-9 )
In ruby 1.9 include? steps through all the values in the range, checking for equality, this is of course a lot slower, particularly for large ranges, for example date ranges
The old include? logic is available as cover?, which this patch changes validates_inclusion_of to use when checking ranges on 1.9
Comments and changes to this ticket
-
Xavier Noria February 18th, 2011 @ 07:25 PM
- Assigned user set to Xavier Noria
-
Xavier Noria February 18th, 2011 @ 08:25 PM
- State changed from new to open
-
Repository February 18th, 2011 @ 08:33 PM
- State changed from open to committed
(from [d7b539aae2dec5835d59d9d7373c96d2ec8f662d]) Change validates inclusion to use cover? for Ranges in ruby 1.9 [#6453 state:committed]
Signed-off-by: Xavier Noria fxn@hashref.com
https://github.com/rails/rails/commit/d7b539aae2dec5835d59d9d7373c9... -
Repository February 18th, 2011 @ 08:33 PM
(from [fbfa30a1eeaaab22ac8f43a4137ec8282920fe15]) Change validates inclusion to use cover? for Ranges in ruby 1.9 [#6453 state:committed]
Signed-off-by: Xavier Noria fxn@hashref.com
https://github.com/rails/rails/commit/fbfa30a1eeaaab22ac8f43a4137ec...
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
Tags
Referenced by
- 6453 Use cover? for validates_inclusion_of with Ranges on 1.9 (from [d7b539aae2dec5835d59d9d7373c96d2ec8f662d]) Change ...
- 6453 Use cover? for validates_inclusion_of with Ranges on 1.9 (from [fbfa30a1eeaaab22ac8f43a4137ec8282920fe15]) Change ...