settings_controller.rb 368 B

1234567891011121314151617181920
  1. # frozen_string_literal: true
  2. class Api::Web::SettingsController < Api::Web::BaseController
  3. respond_to :json
  4. before_action :require_user!
  5. def update
  6. setting.data = params[:data]
  7. setting.save!
  8. render_empty
  9. end
  10. private
  11. def setting
  12. @_setting ||= ::Web::Setting.where(user: current_user).first_or_initialize(user: current_user)
  13. end
  14. end