diff --git a/lib/spree/chimpy/controller_filters.rb b/lib/spree/chimpy/controller_filters.rb index 96928d7..dd84d09 100644 --- a/lib/spree/chimpy/controller_filters.rb +++ b/lib/spree/chimpy/controller_filters.rb @@ -3,11 +3,9 @@ module ControllerFilters extend ActiveSupport::Concern included do - include ::Spree::Core::ControllerHelpers::Order - before_filter :set_mailchimp_params before_filter :find_mail_chimp_params, if: :mailchimp_params? - # before_filter :no_current_order, unless: :mailchimp_params? + include ::Spree::Core::ControllerHelpers::Order end private @@ -24,12 +22,8 @@ def mailchimp_params? (!session[:order_id].nil? || !params[:record_mc_details].nil?) end - # def no_current_order - # send(:remove_method, :set_current_order) - # end - def find_mail_chimp_params - attributes = {campaign_id: mc_cid, email_id: mc_eid} + attributes = { campaign_id: mc_cid, email_id: mc_eid } if current_order(create_order_if_necessary: true).source current_order.source.update_attributes(attributes) else diff --git a/spec/controllers/controller_filters_spec.rb b/spec/controllers/controller_filters_spec.rb index 1d71715..40961b1 100644 --- a/spec/controllers/controller_filters_spec.rb +++ b/spec/controllers/controller_filters_spec.rb @@ -34,11 +34,4 @@ def index get :index end - - it 'skips the set_current_order filter if not needed' do - filter_list = subject._process_action_callbacks.map(&:filter) - expect(filter_list).to_not include(:set_curent_order) - - get :index - end end