5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/spree/core/controller_helpers/respond_with.rb', line 5
def respond_with(*resources, &block)
raise "In order to use respond_with, first you need to declare the formats your " <<
"controller responds to in the class level" if self.class.mimes_for_respond_to.empty?
if collector = retrieve_collector_from_mimes(&block)
options = resources.size == 1 ? {} : resources.
if defined_response = collector.response and !Spree::BaseController.spree_responders.keys.include?(self.class.to_s.to_sym)
if action = options.delete(:action)
render :action => action
else
defined_response.call
end
else
options.merge!(:action_name => action_name.to_sym)
responder = options.delete(:responder) || self.responder
responder.call(self, resources, options)
end
end
end
|