Hi,
I want to prevent users from signing up with a password = login for security reasons. I tried something like this:
validates_each :password do |record, attr, value|
if(value == self.login)
record.errors.add(attr)
end
end
But I always get the following error: undefined method login for self. It has something to do with the class hierachy I guess, but how do I access a higher level.
I'm a little stuck here, please help.
From stackoverflow
-
Try
if value == record.login
the record is passed into the block as the
record
local variable, and in this context is notself
.ole_berlin : Very simple... Very nice, thanks!
0 comments:
Post a Comment