#373 ✓resolved
David Yeu

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

    Bernerd Schaefer July 10th, 2008 @ 09:37 AM

    • State changed from “new” to “resolved”
    • Tag set to bug, dm-more, validations

    Thanks, David, for the fix. I've applied it as of ae861dd on dm-more.

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

Pages