Class: Satis::UserDataController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Satis::UserDataController
- Defined in:
- app/controllers/satis/user_data_controller.rb
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'app/controllers/satis/user_data_controller.rb', line 3 def show key = request.url.split('/user_data/').last data = Satis.config.current_user.call.user_data.keyed(key) if data.id.present? render json: data.data, status: 200 else render json: {}, status: 404 end end |
#update ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/satis/user_data_controller.rb', line 14 def update key = request.url.split('/user_data/').last data = Satis.config.current_user.call.user_data.keyed(key) new_data = data.data.merge(user_data_update_params.as_json) data.data = new_data #data.data = user_data_update_params.as_json data.save! render json: data.data, status: 200 end |