Class: Kms::UsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Kms::UsersController
- Defined in:
- app/controllers/kms/users_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #kms_user ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/controllers/kms/users_controller.rb', line 12 def create @user = User.new(user_params) if @user.save head :no_content else render json: { errors: @user.errors. }.to_json, status: :unprocessable_entity end end |
#destroy ⇒ Object
35 36 37 38 39 |
# File 'app/controllers/kms/users_controller.rb', line 35 def destroy @user = User.find(params[:id]) @user.destroy head :no_content end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/kms/users_controller.rb', line 8 def index render json: User.all end |
#kms_user ⇒ Object
41 42 43 |
# File 'app/controllers/kms/users_controller.rb', line 41 def kms_user render json: current_kms_user end |
#show ⇒ Object
30 31 32 33 |
# File 'app/controllers/kms/users_controller.rb', line 30 def show @user = User.find(params[:id]) render json: @user end |
#update ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/controllers/kms/users_controller.rb', line 21 def update @user = User.find(params[:id]) if @user.update(user_params) head :no_content else render json: { errors: @user.errors. }.to_json, status: :unprocessable_entity end end |