Class: SolidusBraintree::ConfigurationsController
- Inherits:
-
Spree::Admin::BaseController
- Object
- Spree::Admin::BaseController
- SolidusBraintree::ConfigurationsController
- Defined in:
- lib/controllers/backend/solidus_braintree/configurations_controller.rb
Instance Method Summary collapse
Instance Method Details
#list ⇒ Object
7 8 9 10 11 |
# File 'lib/controllers/backend/solidus_braintree/configurations_controller.rb', line 7 def list :list, SolidusBraintree::Configuration @configurations = ::Spree::Store.all.map { |s| s.braintree_configuration || s.create_braintree_configuration } end |
#update ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/controllers/backend/solidus_braintree/configurations_controller.rb', line 13 def update :update, SolidusBraintree::Configuration params = configurations_params[:configuration_fields] results = SolidusBraintree::Configuration.update(params.keys, params.values) if results.all?(&:valid?) flash[:success] = t('update_success', scope: 'solidus_braintree.configurations') else flash[:error] = t('update_error', scope: 'solidus_braintree.configurations') end redirect_to action: :list end |