settings_controller.rb 348 B

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