On Feb 22, 2010, at 7:26 PM, donz wrote:
This may be as much a Ruby question as an Hobo question. Hobo defines
password_validates in:
module Hobo
module ClassMethods
def password_validations ...
The Hobo cookbook says "You will probably wish to use a stricter
validation. If so, redefine the password_validations function:
def password_validations
validates_length_of :password, :within => 4..40, :if
=> :new_password_required?
end
I do want to increase the password complexity (8 chars min, at least
one cap, one lower, 1 numeral. The question is, where do I put the
redefined password_validations method (without hacking the base Hobo
code)?
I have tried adding it to the User.rb model, but that doesn't work. I
have tried adding it by
include Hobo
module Hobo
module ClassMethods
def password_validations ...
in the user helpers file (that crashed the whole website).
I give up!
There's two places that seem to work:
- above the hobo_user_model line in your model, add:
def self.password_validations
...
end
(yes, I know it says not to add anything above that...)
- in an initializer:
module Hobo
module User
module ClassMethods
def password_validations
...
end
end
end
end
The trick is that the only time password_validations is called is via
the included hook on Hobo::User - so you've got to redefine it before
that.
--Matt Jones
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" 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/hobousers?hl=en.