Skip to content

Instantly share code, notes, and snippets.

@tsolar
Last active June 9, 2016 16:56
Show Gist options
  • Save tsolar/a8b0c04138b010f2d02206ed44c95ccd to your computer and use it in GitHub Desktop.
Save tsolar/a8b0c04138b010f2d02206ed44c95ccd to your computer and use it in GitHub Desktop.
Permitir sólo a algunos emails acceder a la app en Rails
# from http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Authenticatable
# Poner en el modelo User
def special_condition_is_valid?
permitted_emails = [
# Poner acá los emails permitidos para acceder
"[email protected]",
"[email protected]"
]
if permitted_emails.include?(self.email)
return true
else
return false
end
end
def active_for_authentication?
super && special_condition_is_valid?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment