
property ... :nullable => true will raise NoMethodError
Reported by Camilo Lopez | March 19th, 2008 @ 03:57 PM
To reproduce:
class M < DataMapper::Base
property :name, :string, :nullable => true
end
The problems is nullable autovalidation lambda function will return nil when nullable != false
From lib/datamaper/property.rb
# NOTE: :length may also be used in place of :size
AUTO_VALIDATIONS = {
:nullable => lambda { |k,v| "validates_presence_of :#{k}" if v == false },
:size => lambda { |k,v| "validates_length_of :#{k}, " + (v.is_a?(Range) ? ":minimum => #{v.first}, :maximum => #{v.last}" : ":maximum => #{v}") },
:format => lambda { |k, v| "validates_format_of :#{k}, :with => #{v.inspect}" }
}
Comments and changes to this ticket
-
-
Dan Kubb (dkubb) April 15th, 2008 @ 03:06 AM
- Milestone cleared.
-
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »