Class: Api::V1::UsersController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/fbuser/api/v1/users_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject

DELETE /api/1/users/1



46
47
48
49
# File 'app/controllers/fbuser/api/v1/users_controller.rb', line 46

def destroy
  @user.destroy
  render json: {}
end

#indexObject

GET /api/1/users



14
15
16
17
# File 'app/controllers/fbuser/api/v1/users_controller.rb', line 14

def index
  @users = ::Fbuser::V1::User.all
  render json: @users
end

#showObject

GET /api/1/users/1



20
21
22
# File 'app/controllers/fbuser/api/v1/users_controller.rb', line 20

def show
	render json: @user
end

#updateObject

PATCH/PUT /api/1/users/1



37
38
39
40
41
42
43
# File 'app/controllers/fbuser/api/v1/users_controller.rb', line 37

def update
	if @user.update(user_params)
    render json: @user
  else
    render :json => {errors: @user.errors.full_messages}, status: :unprocessable_entity
  end
end