Class: Golden::Setting::SettingsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Golden::Setting::SettingsController
- Defined in:
- app/controllers/golden/setting/settings_controller.rb
Instance Method Summary collapse
- #batch_update ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #list ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#batch_update ⇒ Object
52 53 54 55 56 57 |
# File 'app/controllers/golden/setting/settings_controller.rb', line 52 def batch_update params[:setting].each do |setting, value| @setting_class.send "#{setting}=", value end if params[:setting] redirect_to action: :index end |
#create ⇒ Object
30 31 32 33 |
# File 'app/controllers/golden/setting/settings_controller.rb', line 30 def create @setting.save respond_with @setting, location: setting_path(@setting) end |
#destroy ⇒ Object
42 43 44 45 |
# File 'app/controllers/golden/setting/settings_controller.rb', line 42 def destroy @setting.destroy respond_with @setting, location: settings_path end |
#edit ⇒ Object
27 28 |
# File 'app/controllers/golden/setting/settings_controller.rb', line 27 def edit end |
#index ⇒ Object
14 15 16 17 |
# File 'app/controllers/golden/setting/settings_controller.rb', line 14 def index @default_tab = Golden::Setting.default_tab respond_with @settings end |
#list ⇒ Object
47 48 49 50 |
# File 'app/controllers/golden/setting/settings_controller.rb', line 47 def list @settings = @settings.paginate page: params[:page] respond_with @settings end |
#new ⇒ Object
23 24 25 |
# File 'app/controllers/golden/setting/settings_controller.rb', line 23 def new respond_with @setting end |
#show ⇒ Object
19 20 21 |
# File 'app/controllers/golden/setting/settings_controller.rb', line 19 def show respond_with @setting end |
#update ⇒ Object
35 36 37 38 39 40 |
# File 'app/controllers/golden/setting/settings_controller.rb', line 35 def update value = params[:setting].delete :value @setting.value = value @setting.update_attributes setting_params respond_with @setting, location: setting_path(@setting) end |