GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of rails/rails
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/ddollar/rails.git
Made the sharing of request and response safer

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@744 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
dhh (author)
Tue Feb 22 06:14:42 -0800 2005
commit  b68b47672e613e94a7859c9549e9cd4b401f7b79
tree    65fe55277e080282e6e2306f31a23d369a854aa1
parent  752f9ab8739bef4d7acab21af5858f5d5d9db6eb
...
1
 
2
3
4
...
14
15
16
17
18
 
 
19
20
21
22
23
24
25
26
 
 
27
28
29
...
31
32
33
34
 
35
36
37
38
39
40
 
 
 
 
41
42
...
1
2
3
4
5
...
15
16
17
 
 
18
19
20
21
22
23
24
25
 
 
26
27
28
29
30
...
32
33
34
 
35
36
37
38
39
40
41
42
43
44
45
46
47
0
@@ -1,4 +1,5 @@
0
 module ActionController #:nodoc:
0
+ # TODO: Cookies and session variables set in render_component that happens inside a view should be copied over.
0
   module Components #:nodoc:
0
     def self.append_features(base)
0
       super
0
@@ -14,16 +15,16 @@ module ActionController #:nodoc:
0
 
0
     protected
0
       def render_component(options = {}) #:doc:
0
- response = component_response(options)
0
- logger.info "Rendering component (#{options.inspect}): "
0
+ response = component_response(options, true)
0
+ logger.info "Start rendering component (#{options.inspect}): "
0
         result = render_text(response.body, response.headers["Status"])
0
         logger.info("\n\nEnd of component rendering")
0
         return result
0
       end
0
   
0
     private
0
- def component_response(options)
0
- component_class(options).process(component_request(options), @response)
0
+ def component_response(options, reuse_response = false)
0
+ component_class(options).process(component_request(options), reuse_response ? @response : component_response)
0
       end
0
     
0
       def component_class(options)
0
@@ -31,12 +32,16 @@ module ActionController #:nodoc:
0
       end
0
       
0
       def component_request(options)
0
- component_request = @request.dup
0
+ component_request = Marshal::load(Marshal::dump(@request))
0
         component_request.send(
0
           :instance_variable_set, :@parameters,
0
           (options[:params] || {}).merge({ "controller" => options[:controller], "action" => options[:action] })
0
         )
0
         return component_request
0
       end
0
+
0
+ def component_response
0
+ Marshal::load(Marshal::dump(@response))
0
+ end
0
   end
0
 end

Comments

    No one has commented yet.