#646 ✓resolved
Liam Morley (carpeliam)

validation for ":length => (1..100)" broken when field = nil

Reported by Liam Morley (carpeliam) | November 10th, 2008 @ 11:43 AM

This is with dm-validations 0.9.6, not sure if it's fixed since then.

I have a class with "property :title, String, :length => (2..100)". my_obj.valid? returns false when title equals 'a', but returns true when title equals nil. It should return false in both circumstances.

It looks like it's only broken when the length is part of the property declaration - if I have "validates_length :title, :in => (1..100)" on a separate line, then my_obj.valid? correctly returns false when title is nil. Anybody using the validation as part of the property declaration could consider this a workaround.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket