Class: Api::UsersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Api::UsersController
- Includes:
- ActionController::Serialization, LoggedInControllerConcern
- Defined in:
- app/controllers/api/users_controller.rb
Instance Method Summary collapse
-
#search ⇒ Object
Returns the user with matching email.
-
#show ⇒ Object
Renders the current user as json.
Instance Method Details
#search ⇒ Object
Returns the user with matching email
‘GET /api/users/search?email=xxx`
18 19 20 21 22 23 24 25 |
# File 'app/controllers/api/users_controller.rb', line 18 def search user = User.where("email = ? AND id != ?", params[:email], @user.id).first if user render json: user else render status: :not_found end end |
#show ⇒ Object
Renders the current user as json
‘GET /api/user/:id`
10 11 12 |
# File 'app/controllers/api/users_controller.rb', line 10 def show render json: @user end |