Module: Spotlight::Concerns::UserExistable
- Included in:
- AdminUsersController, RolesController
- Defined in:
- app/controllers/spotlight/concerns/user_existable.rb
Overview
Mixin to be included into controllers that provides a method to check if a particular user exists in the site
Instance Method Summary collapse
Instance Method Details
#exists ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/spotlight/concerns/user_existable.rb', line 7 def exists # note: the messages returned are not shown to users and really only useful for debug, hence no translation necessary # app uses html status code to act on response if Spotlight::Engine.user_class.where(email: exists_params).present? render json: { message: 'User exists' } else render json: { message: 'User does not exist' }, status: :not_found end end |