This project is archived and is in readonly mode.

#2981 ✓resolved

validates_length_of should exclude last member of an end-excluding range

Reported by jed | July 31st, 2009 @ 07:07 PM

If provided with an end-excluding range, validates_length_of will not exclude the last member of the range.

In the code below, the current behavior of validates_length_of will consider the first_name attribute valid if it is 61 characters long.

class Person << ActiveRecord::Base
  validates_length_of :first_name, :in => 3...61

The attached patch corrects this by properly excluding the last member of an exclusive range.

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>

People watching this ticket

Referenced by