Validations fail for private properties
Reported by David Yeu | June 11th, 2008 @ 10:50 PM
Currently, a property defined like:
property :crypted_password, String, :nullable => false, :accessor => :private
will cause a save to fail, since the value can't be accessed by the auto-created validates_present.
The offending code in dm-validations/lib/dm-validations.rb:
def validation_property_value(name)
return self.instance_variable_get("@#{name}") if self.instance_variables.include?(name)
return self.send(name) if self.respond_to?(name)
nil
end
A trivial commit -- http://github.com/daveyeu/dm-mor... -- fixes this by using "respond_to?(name, true)" instead.
Comments and changes to this ticket
-
Bernerd Schaefer July 10th, 2008 @ 09:37 AM
- → State changed from new to resolved
- → Tag changed from to bug dm-more validations
Thanks, David, for the fix. I've applied it as of ae861dd on dm-more.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
