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.
Try
the record is passed into the block as the
recordlocal variable, and in this context is notself.