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
19 20 21 |
# File 'app/controllers/admin/configuration_controller.rb', line 19 def edit render end |
#show ⇒ Object
14 15 16 17 |
# File 'app/controllers/admin/configuration_controller.rb', line 14 def show @user = current_user render end |
#update ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/admin/configuration_controller.rb', line 23 def update if params[:trusty_config] begin TrustyCms.config.transaction do params[:trusty_config].each_pair do |key, value| @trusty_config[key] = TrustyCms::Config.find_or_initialize_by(key: key) @trusty_config[key].value = value # validation sets errors on @trusty_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 TrustyCms::Config::ConfigError => e flash[:error] = "Configuration error: #{e}" render action: :edit end end end |