Class: NsSettingsUi::SettingsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ns_settings_ui/settings_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject


6
7
8
# File 'app/controllers/ns_settings_ui/settings_controller.rb', line 6

def index
  @settings = Setting.order('`key`').all
end

#resetObject


17
18
19
20
21
# File 'app/controllers/ns_settings_ui/settings_controller.rb', line 17

def reset
  @setting.value = @setting.default_value
  @setting.save!
  render partial: 'update'
end

#updateObject


10
11
12
13
14
15
# File 'app/controllers/ns_settings_ui/settings_controller.rb', line 10

def update
  @setting.value = params[:setting][:value]
  @setting.default_value = params[:setting][:default_value]
  @setting.save!
  render partial: 'update'
end