Class: Admin::ConfigurationController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::ConfigurationController
- Defined in:
- app/controllers/admin/configuration_controller.rb
Instance Method Summary collapse
Instance Method Details
#edit ⇒ Object
20 21 22 |
# File 'app/controllers/admin/configuration_controller.rb', line 20 def edit render end |
#show ⇒ Object
15 16 17 18 |
# File 'app/controllers/admin/configuration_controller.rb', line 15 def show @user = current_user render end |
#update ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/admin/configuration_controller.rb', line 24 def update if params[:config] begin Radiant.config.transaction do params["config"].each_pair do |key, value| @config[key] = Radiant::Config.find_or_create_by_key(key) @config[key].value = value # validation sets errors on @config['key'] that the helper methods will pick up end redirect_to :action => :show end rescue ActiveRecord::RecordInvalid => e flash[:error] = "Configuration error: please check the form" render :action => :edit rescue Radiant::Config::ConfigError => e flash[:error] = "Configuration error: #{e}" render :action => :edit end end end |