Class: Ecom::Core::UsersController
Instance Method Summary
collapse
#current_user, #logged_in?
Instance Method Details
#active ⇒ Object
10
11
12
|
# File 'app/controllers/ecom/core/users_controller.rb', line 10
def active
render json: User.active
end
|
#create ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'app/controllers/ecom/core/users_controller.rb', line 14
def create
user = User.new(user_params)
if user.save
render json: user, status: :created
else
render json: { success: false, errors: user.errors }, status: :unprocessable_entity
end
end
|
#index ⇒ Object
6
7
8
|
# File 'app/controllers/ecom/core/users_controller.rb', line 6
def index
render json: User.all
end
|
#update ⇒ Object
23
24
25
26
27
28
29
|
# File 'app/controllers/ecom/core/users_controller.rb', line 23
def update
if @user.update(user_params)
render json: @user
else
render json: { success: false, errors: @user.errors }, status: :unprocessable_entity
end
end
|