
validates_email-helper suggestion
Reported by Jonas Grimfelt | April 22nd, 2009 @ 07:10 PM
Except for the validation of login-email under the hood, would be neat if one could reuse this validator in a clean way like:
validates_email :other_email
Right now I call Authlogic validator in a quite shady way. If the functionality is there, maybe a model validation helper would be convenient for less redundant code?
Comments and changes to this ticket
-
Ben Johnson April 23rd, 2009 @ 02:00 AM
- State changed from new to open
Hmm, that's an interesting idea. You may be onto something. For the time being you could do something like
validates_format_of Authlogic::Session::Base.validates_format_of_email_options
I can see why you don't like that. Let me give this some more thought.
-
Ben Johnson May 4th, 2009 @ 12:30 AM
- State changed from open to resolved
Alright, I extracted the regular expressions into Authlogic::Regex. So you can do
Authlogic::Regex.email Authlogic::Regex.login
So you can call your own validates_format_of :other_email, :with => Authlogic::Regex.email
Hope this helps.
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Object based authentication solution that handles all of the non sense for you. It's as easy as ActiveRecord is with a database.