Class: LatoSettings::SettingsController
- Inherits:
-
ApplicationController
- Object
- Lato::ApplicationController
- ApplicationController
- LatoSettings::SettingsController
- Defined in:
- app/controllers/lato_settings/settings_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/controllers/lato_settings/settings_controller.rb', line 18 def create @setting = Setting.new(setting_params) if @setting.save redirect_to settings_path else render 'new' end end |
#destroy ⇒ Object
40 41 42 43 44 |
# File 'app/controllers/lato_settings/settings_controller.rb', line 40 def destroy @setting = Setting.find(params[:id]) @setting.destroy redirect_to settings_path end |
#edit ⇒ Object
27 28 29 |
# File 'app/controllers/lato_settings/settings_controller.rb', line 27 def edit @setting = Setting.find(params[:id]) end |
#index ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'app/controllers/lato_settings/settings_controller.rb', line 3 def index @settings = lato_index_collection( Setting.all, columns: %i[label value key updated_at actions], searchable_columns: %i[key label value], sortable_columns: %i[updated_at], pagination: true, default_sort_by: "key|asc" ) end |
#new ⇒ Object
14 15 16 |
# File 'app/controllers/lato_settings/settings_controller.rb', line 14 def new @setting = Setting.new(typology: params[:typology]) end |
#update ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'app/controllers/lato_settings/settings_controller.rb', line 31 def update @setting = Setting.find(params[:id]) if @setting.update(setting_params) redirect_to settings_path else render 'edit' end end |