This project is archived and is in readonly mode.

#6453 ✓committed
Frederick Cheung

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 ( )

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

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=""></a>

Referenced by