Class: Tomify::Api::Public::UsersController
- Inherits:
-
Object
- Object
- Tomify::Api::Public::UsersController
- Defined in:
- app/controllers/tomify/api/public/users_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 |
# File 'app/controllers/tomify/api/public/users_controller.rb', line 6 def create session[:current_user_id] = Tomify.models.user.create!(record_params).id flash[:success] = "Welcome #{current_user.name}!" render json: { type: :success, message: "Welcome #{current_user.name}!" } rescue ActiveRecord::RecordInvalid => e render json: { type: :warning, message: e.record.errors..join(", ") } end |
#update ⇒ Object
14 15 16 17 18 19 |
# File 'app/controllers/tomify/api/public/users_controller.rb', line 14 def update current_user.update!(record_params) render json: { type: :success, message: "Profile Updated" } rescue ActiveRecord::RecordInvalid => e render json: { type: :warning, message: e.record.errors..join(", ") } end |