diff options
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 |