On 25 August 2013 18:32, Kaushik Tiwari <kaushik.tewari@gmail.com> wrote:
> I am trying to use validates_format_of in my model file to validate an email
> address. However, I need to enter two regexes for two special cases.
> Basically, only a few top-level domain names are allowed.
>
> However, it seems according to the source code for validates it only allows
> one :format key and one set of options as the hash value. Is there a way to
> use multiple regexes.
Just extend the regex to include both cases. For example abc|def|xyz
matches abc, def or xyz.
Colin
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvjQ52Xp_qi8g63iTePKj0sOS8D-kbKOukeekiGx1fuOA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment