Class: Kms::UsersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/kms/users_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#set_csrf_cookie_for_ng

Instance Method Details

#createObject



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.full_messages }.to_json, status: :unprocessable_entity
  end
end

#destroyObject



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

#indexObject



8
9
10
# File 'app/controllers/kms/users_controller.rb', line 8

def index
  render json: User.all
end

#kms_userObject



41
42
43
# File 'app/controllers/kms/users_controller.rb', line 41

def kms_user
  render json: current_kms_user
end

#showObject



30
31
32
33
# File 'app/controllers/kms/users_controller.rb', line 30

def show
  @user = User.find(params[:id])
  render json: @user
end

#updateObject



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.full_messages }.to_json, status: :unprocessable_entity
  end
end