Class: ActionController::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/spree/core/controller_helpers/respond_with.rb

Instance Method Summary collapse

Instance Method Details

#respond_with(*resources, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/spree/core/controller_helpers/respond_with.rb', line 5

def respond_with(*resources, &block)
  if Spree::BaseController.spree_responders.keys.include?(self.class.to_s.to_sym)
    # Checkout AS Array#extract_options! and original respond_with
    # implementation for a better picture of this hack
    if resources.last.is_a? Hash
      resources.last.merge! action_name: action_name.to_sym
    else
      resources.push action_name: action_name.to_sym
    end
  end

  super
end