Class: SupplejackApi::UsersController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_admin!, #authenticate_user!, #current_user, #find_user_set

Instance Method Details

#createObject



19
20
21
22
# File 'app/controllers/supplejack_api/users_controller.rb', line 19

def create
  @user = User.create(user_params)
  respond_with @user, location: user_url(@user), serializer: UserSerializer
end

#destroyObject



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

def destroy
  @user = User.custom_find(params[:id])
  @user.destroy
  respond_with @user
end

#showObject



14
15
16
17
# File 'app/controllers/supplejack_api/users_controller.rb', line 14

def show
  @user = User.custom_find(params[:id])
  respond_with @user, serializer: UserSerializer
end

#updateObject



24
25
26
27
28
# File 'app/controllers/supplejack_api/users_controller.rb', line 24

def update
  @user = User.custom_find(params[:id])
  @user.update_attributes(user_params)
  render json: @user, serializer: UserSerializer
end