Trying to validate the email field in a rails devise app with a word exclusion.
validates :email, :exclusion => {:in => ["admin", "root",,
:message => "is reserved"}
Wich works great on the :username field but not on the email.
I suspect that Devise is “taken over” the validation of the email field and I need to super/ overrule the registrations controller of Devise.
How could I:
- Prevent emails with words based on an :exclusion
- Prevent emails with @myapp.com so users don’t use the domain the app runs on.
You can always write custom validations to achieve what you want. Example from the guide: