From 4baa205cf959199817733002e7eba50b2c9bbf01 Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Tue, 20 Jan 2015 16:19:01 +1100 Subject: [PATCH] before_filters for enterprise controller are run in the correct order, and put inside the shop action --- app/controllers/enterprises_controller.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rb index 4f244bf49f..d8b33e4ad6 100644 --- a/app/controllers/enterprises_controller.rb +++ b/app/controllers/enterprises_controller.rb @@ -2,9 +2,6 @@ class EnterprisesController < BaseController layout "darkswarm" helper Spree::ProductsHelper include OrderCyclesHelper - before_filter :require_distributor_chosen - before_filter :set_order_cycles, only: :shop - before_filter :load_active_distributors, only: :shop before_filter :clean_permalink, only: :check_permalink respond_to :js, only: :permalink_checker @@ -73,6 +70,10 @@ class EnterprisesController < BaseController order_cycle_options = OrderCycle.active.with_distributor(distributor) order.order_cycle = order_cycle_options.first if order_cycle_options.count == 1 order.save! + + require_distributor_chosen + set_order_cycles + load_active_distributors end def check_permalink