Class: Satis::UserDataController

Inherits:
ApplicationController show all
Defined in:
app/controllers/satis/user_data_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



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.user_data.keyed(key)

  if data.id.present?
    render json: data.data, status: 200
  else
    render json: {}, status: 404
  end
end

#updateObject



14
15
16
17
18
19
20
21
22
# File 'app/controllers/satis/user_data_controller.rb', line 14

def update
  key = request.url.split('/user_data/').last
  data = Satis.config.current_user.user_data.keyed(key)

  data.data = user_data_update_params.as_json
  data.save!

  render json: data.data, status: 200
end