Kinda a noob rails programmer, but this would save me a ton of headache. Currently, I'm trying to add validation to my devise sign on page, such as only allowing the sign up to complete if their email ends with a certain extension. Does anyone know where the file location stands that overlooks the sign on page? I've looked over all models and views but can't seem to find it. Thank you!
Asked
Active
Viewed 279 times
1
-
You can add a validation to User model, or whichever your devise model is.`app/models` – sites May 05 '13 at 00:21
-
See here for email validation http://stackoverflow.com/questions/1156601/whats-the-state-of-the-art-in-email-validation-for-rails – sites May 05 '13 at 00:22
-
Thank you so much. I can't believe it was under my nose the whole time. I can feel the love from the stack community :D – Ian Howard May 05 '13 at 00:41
2 Answers
0
I think that you can use validates_format_of in your user.rb model. You can use rubular.com to create the regex.
validates_format_of :email, :with => /MYREGEXHERE/
0
Simply add validation to your email field. There is nothing special you have to do. like:
validates :email, format: { with: /my_ending_string\z/, message: "must ends with my_ending_string" }

Manoj Sehrawat
- 1,283
- 1
- 10
- 25