Class: Admin::SettingsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::SettingsController
- Defined in:
- app/controllers/admin/settings_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 |
# File 'app/controllers/admin/settings_controller.rb', line 16 def create @setting = Radiant::Config.find_or_create_by_key(params[:setting]['key']) @setting.update_attributes(params[:setting]) flash[:notice] = "The setting \"#{@setting.key}\" was created." redirect_to admin_settings_url end |
#destroy ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/controllers/admin/settings_controller.rb', line 32 def destroy @setting = Radiant::Config.find(params[:id]) @key = @setting.key @setting.destroy flash[:notice] = "The setting \"#{@key}\" was deleted." redirect_to admin_settings_url end |
#edit ⇒ Object
23 24 25 |
# File 'app/controllers/admin/settings_controller.rb', line 23 def edit @setting = Radiant::Config.find(params[:id]) end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/admin/settings_controller.rb', line 8 def index @settings = Radiant::Config.find_all_as_tree end |
#new ⇒ Object
12 13 14 |
# File 'app/controllers/admin/settings_controller.rb', line 12 def new @setting = Radiant::Config.new end |
#update ⇒ Object
27 28 29 30 |
# File 'app/controllers/admin/settings_controller.rb', line 27 def update Radiant::Config.find(params[:id]).update_attribute(:value, params[:setting][:value]) redirect_to admin_settings_url end |