diff options
author | Matt Jankowski <mjankowski@thoughtbot.com> | 2017-05-22 17:12:29 -0400 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-05-22 23:12:28 +0200 |
commit | a28ce13b3e7da2159fdc4800214910740a66c3bf (patch) | |
tree | 97ade050c827dc7311e472c00e47bf6a90ab6d60 /app | |
parent | e1b42e9aa01b0c6adab05afb9c5ee0cf9fbb41a9 (diff) |
Coverage for api/web/settings controller (#3238)
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/api/web/settings_controller.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/api/web/settings_controller.rb b/app/controllers/api/web/settings_controller.rb index c00e016a4..7cceb0dfc 100644 --- a/app/controllers/api/web/settings_controller.rb +++ b/app/controllers/api/web/settings_controller.rb @@ -6,10 +6,15 @@ class Api::Web::SettingsController < ApiController before_action :require_user! def update - setting = ::Web::Setting.where(user: current_user).first_or_initialize(user: current_user) setting.data = params[:data] setting.save! render_empty end + + private + + def setting + @_setting ||= ::Web::Setting.where(user: current_user).first_or_initialize(user: current_user) + end end |