Hi Joe

I think the best way to handle this is probably by making the password
an accessor and having a different property for the password in the
DB.  You can then try something like https://gist.github.com/1039058
or alternatively:

attr_reader :password

property :encrypted_password, BCryptHash, :required => true

validates_presence_of :password

def password=(password)
  self.encrypted_password = passwoard
  @password = password
end

Regards
Jonathan

On 18 August 2011 15:29, joe <[email protected]> wrote:
> If I have a  BCryptHash property, e.g.,
>    property :password,     BCryptHash, :length => 6..8
> then it appears that the length validation is run after the password
> is converted to a hash and always fails. Is there a mechanism for
> doing this?
>
> Thanks.
>
> Joe
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "DataMapper" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/datamapper?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to