public
Description: response for lets you decorate your actions respond_to blocks
Homepage: http://blog.ardes.com/response_for
Clone URL: git://github.com/ianwhite/response_for.git
Click here to lend your support to: response_for and make a donation at www.pledgie.com !
Fixed bug where response_for was clobbering the respond_to when the respond_to 
relied on default_render? [thanks to Tom Stuart for the report]
ianwhite (author)
Sun Oct 19 15:11:00 -0700 2008
commit  37c5ff4c91f2974a4493ed4233f84d4f6d757c26
tree    67546b4245358d6c872c4897379f2cc44b975db6
parent  0cb80d7a78efab2be80d2f99bfac3699a9c2dcdc
...
6
7
8
 
9
10
11
...
134
135
136
137
 
138
139
140
...
148
149
150
 
 
 
 
 
151
152
153
...
6
7
8
9
10
11
12
...
135
136
137
 
138
139
140
141
...
149
150
151
152
153
154
155
156
157
158
159
0
@@ -6,6 +6,7 @@ module Ardes #:nodoc:
0
         extend ClassMethods
0
         alias_method_chain :default_render, :response_for
0
         alias_method_chain :template_exists?, :response_for
0
+        alias_method_chain :respond_to, :response_for
0
       end
0
     end
0
     
0
@@ -134,7 +135,7 @@ module Ardes #:nodoc:
0
     # we rescue the case where there were no responses, so that the default_render
0
     # action will be performed
0
     def respond_to_action_responses
0
-      if (responses = self.class.action_responses[action_name]) && responses.any?
0
+      if !@respond_to_performed && (responses = self.class.action_responses[action_name]) && responses.any?
0
         respond_to do |responder|
0
           responses.each {|response| instance_exec(responder, &response) }
0
         end rescue Responder::NoResponsesError
0
@@ -148,6 +149,11 @@ module Ardes #:nodoc:
0
       default_render_without_response_for unless performed?
0
     end
0
     
0
+    def respond_to_with_response_for(*args, &block)
0
+      @respond_to_performed = true
0
+      respond_to_without_response_for(*args, &block)
0
+    end
0
+    
0
     # included into ActionController::MimeResponds::Responder
0
     module Responder
0
       class NoResponsesError < RuntimeError; end

Comments