settings_controller.rb 368 B

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