about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorMatt Jankowski <mjankowski@thoughtbot.com>2017-05-22 17:12:29 -0400
committerEugen Rochko <eugen@zeonfederated.com>2017-05-22 23:12:28 +0200
commita28ce13b3e7da2159fdc4800214910740a66c3bf (patch)
tree97ade050c827dc7311e472c00e47bf6a90ab6d60 /app
parente1b42e9aa01b0c6adab05afb9c5ee0cf9fbb41a9 (diff)
Coverage for api/web/settings controller (#3238)
Diffstat (limited to 'app')
-rw-r--r--app/controllers/api/web/settings_controller.rb7
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