Changeset 5207
- Timestamp:
- 09/29/06 08:26:45 (2 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/base.rb (modified) (3 diffs)
- trunk/actionpack/lib/action_controller/caching.rb (modified) (2 diffs)
- trunk/actionpack/lib/action_controller/components.rb (modified) (1 diff)
- trunk/actionpack/lib/action_controller/cookies.rb (modified) (1 diff)
- trunk/actionpack/lib/action_controller/layout.rb (modified) (1 diff)
- trunk/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml (modified) (3 diffs)
- trunk/actionpack/lib/action_controller/templates/rescues/template_error.rhtml (modified) (1 diff)
- trunk/actionpack/test/fixtures/deprecated_instance_variables/_response_ivar.rhtml (added)
- trunk/actionpack/test/fixtures/deprecated_instance_variables/_response_method.rhtml (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r5206 r5207 3 3 * assert_select_rjs decodes escaped unicode chars since the Javascript generators encode them. #6240 [japgolly] 4 4 5 * Deprecation: @cookies, @headers, @request will be removed after 1.2. Use the corresponding method instead. [Jeremy Kemper]5 * Deprecation: @cookies, @headers, @request, @response will be removed after 1.2. Use the corresponding method instead. [Jeremy Kemper] 6 6 7 7 * Make the :status parameter expand to the default message for that status code if it is an integer. Also support symbol statuses. [Jamis Buck]. Examples: trunk/actionpack/lib/action_controller/base.rb
r5206 r5207 305 305 # has been rendered through response.body -- useful for <tt>after_filter</tt>s that wants to manipulate the output, 306 306 # such as a OutputCompressionFilter. 307 attr_ accessor:response307 attr_internal :response 308 308 309 309 # Holds a hash of objects in the session. Accessed like <tt>session[:person]</tt> to get the object tied to the "person" … … 1017 1017 @_request, @_params, @_cookies = request, request.parameters, request.cookies 1018 1018 1019 @ response = response1020 @ response.session = request.session1021 1022 @_session = @ response.session1023 @template = @ response.template1024 @assigns = @ response.template.assigns1025 1026 @_headers = @ response.headers1019 @_response = response 1020 @_response.session = request.session 1021 1022 @_session = @_response.session 1023 @template = @_response.template 1024 @assigns = @_response.template.assigns 1025 1026 @_headers = @_response.headers 1027 1027 1028 1028 assign_deprecated_shortcuts(request, response) … … 1129 1129 else 1130 1130 %w(@assigns @performed_redirect @performed_render 1131 @_request @request @response @_params @params @_session @session 1132 @_cookies @cookies @template @request_origin @parent_controller) 1131 @_request @request @_response @response @_params @params 1132 @_session @session @_cookies @cookies 1133 @template @request_origin @parent_controller) 1133 1134 end 1134 1135 end trunk/actionpack/lib/action_controller/caching.rb
r5129 r5207 126 126 end 127 127 128 # Manually cache the +content+ in the key determined by +options+. If no content is provided, the contents of @response.body is used128 # Manually cache the +content+ in the key determined by +options+. If no content is provided, the contents of response.body is used 129 129 # If no options are provided, the current +options+ for this action is used. Example: 130 130 # cache_page "I'm the cached content", :controller => "lists", :action => "show" 131 131 def cache_page(content = nil, options = {}) 132 132 return unless perform_caching && caching_allowed 133 self.class.cache_page(content || @response.body, url_for(options.merge({ :only_path => true, :skip_relative_url_root => true })))133 self.class.cache_page(content || response.body, url_for(options.merge({ :only_path => true, :skip_relative_url_root => true }))) 134 134 end 135 135 136 136 private 137 137 def caching_allowed 138 !@request.post? && @response.headers['Status'] && @response.headers['Status'].to_i < 400138 !@request.post? && response.headers['Status'] && response.headers['Status'].to_i < 400 139 139 end 140 140 end … … 185 185 end 186 186 187 class ActionCacheFilter #:nodoc: 187 class ActionCacheFilter #:nodoc: 188 188 def initialize(*actions, &block) 189 189 @actions = actions trunk/actionpack/lib/action_controller/components.rb
r5201 r5207 127 127 klass = component_class(options) 128 128 request = request_for_component(klass.controller_name, options) 129 response = reuse_response ? @response : @response.dup129 new_response = reuse_response ? response : response.dup 130 130 131 klass.process_with_components(request, response, self)131 klass.process_with_components(request, new_response, self) 132 132 end 133 133 134 134 # determine the controller class for the component request 135 135 def component_class(options) trunk/actionpack/lib/action_controller/cookies.rb
r5205 r5207 34 34 # Deprecated cookie writer method 35 35 def cookie(*options) 36 @response.headers["cookie"] << CGI::Cookie.new(*options)36 response.headers['cookie'] << CGI::Cookie.new(*options) 37 37 end 38 38 end trunk/actionpack/lib/action_controller/layout.rb
r4728 r5207 251 251 add_variables_to_assigns 252 252 @template.instance_variable_set("@content_for_layout", content_for_layout) 253 @response.layout = layout253 response.layout = layout 254 254 render_text(@template.render_file(layout, true), deprecated_status) 255 255 else trunk/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml
r4715 r5207 9 9 <br /><br /> 10 10 <% begin %> 11 <%= form_tag( @request.request_uri, "method" => @request.method) %>11 <%= form_tag(request.request_uri, "method" => request.method) %> 12 12 <input type="hidden" name="BP-RETRY" value="1" /> 13 13 … … 27 27 28 28 <% 29 request_parameters_without_action = @request.parameters.clone29 request_parameters_without_action = request.parameters.clone 30 30 request_parameters_without_action.delete("action") 31 31 request_parameters_without_action.delete("controller") … … 38 38 39 39 <p><a href="#" onclick="document.getElementById('session_dump').style.display='block'; return false;">Show session dump</a></p> 40 <div id="session_dump" style="display:none"><%= debug( @request.session.instance_variable_get("@data")) %></div>40 <div id="session_dump" style="display:none"><%= debug(request.session.instance_variable_get("@data")) %></div> 41 41 42 42 43 43 <h2 style="margin-top: 30px">Response</h2> 44 <b>Headers</b>: <%=h @response.headers.inspect.gsub(/,/, ",\n") %><br/>44 <b>Headers</b>: <%=h response.headers.inspect.gsub(/,/, ",\n") %><br/> trunk/actionpack/lib/action_controller/templates/rescues/template_error.rhtml
r2624 r5207 1 1 <h1> 2 2 <%=h @exception.original_exception.class.to_s %> in 3 <%=h @request.parameters["controller"].capitalize if @request.parameters["controller"]%>#<%=h @request.parameters["action"] %>3 <%=h request.parameters["controller"].capitalize if request.parameters["controller"]%>#<%=h request.parameters["action"] %> 4 4 </h1> 5 5