Class: Api::V1::UsersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Api::V1::UsersController
- Defined in:
- app/controllers/people/api/v1/users_controller.rb
Instance Method Summary collapse
-
#destroy ⇒ Object
DELETE /api/1/users/1.
-
#index ⇒ Object
GET /api/1/users.
-
#show ⇒ Object
GET /api/1/users/1.
-
#update ⇒ Object
PATCH/PUT /api/1/users/1.
Instance Method Details
#destroy ⇒ Object
DELETE /api/1/users/1
41 42 43 44 |
# File 'app/controllers/people/api/v1/users_controller.rb', line 41 def destroy @user.destroy render json: {} end |
#index ⇒ Object
GET /api/1/users
15 16 17 18 |
# File 'app/controllers/people/api/v1/users_controller.rb', line 15 def index @users = ::People::V1::User.all render json: @users end |
#show ⇒ Object
GET /api/1/users/1
21 22 23 |
# File 'app/controllers/people/api/v1/users_controller.rb', line 21 def show render json: @user end |
#update ⇒ Object
PATCH/PUT /api/1/users/1
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/people/api/v1/users_controller.rb', line 26 def update change_password before_email = @user.email if @user.update(user_params) if email_changed?(before_email.downcase,@user.email.downcase) #The email changed, reconfirm email address ::People::AccountMailer.email_confirmation(@user).deliver end render json: @user else render :json => {errors: @user.errors.}, status: :unprocessable_entity end end |