aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-09-29 08:26:45 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-09-29 08:26:45 +0000
commitd15d15b2c236a556f89536961adf2de7f1fd04dc (patch)
tree37f35f4cec5c7bdf34cbf6fbcd2a5ef44cf8a97c /actionpack
parentd7b5b44a0e6fddb772c1c0779489c17e1caa4a39 (diff)
downloadrails-d15d15b2c236a556f89536961adf2de7f1fd04dc.tar.gz
rails-d15d15b2c236a556f89536961adf2de7f1fd04dc.tar.bz2
rails-d15d15b2c236a556f89536961adf2de7f1fd04dc.zip
Deprecate @response
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5207 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rwxr-xr-xactionpack/lib/action_controller/base.rb19
-rw-r--r--actionpack/lib/action_controller/caching.rb8
-rw-r--r--actionpack/lib/action_controller/components.rb6
-rw-r--r--actionpack/lib/action_controller/cookies.rb2
-rw-r--r--actionpack/lib/action_controller/layout.rb2
-rw-r--r--actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml8
-rw-r--r--actionpack/lib/action_controller/templates/rescues/template_error.rhtml2
-rw-r--r--actionpack/test/fixtures/deprecated_instance_variables/_response_ivar.rhtml1
-rw-r--r--actionpack/test/fixtures/deprecated_instance_variables/_response_method.rhtml1
10 files changed, 27 insertions, 24 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index ceec53145b..cd8b075fd2 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -2,7 +2,7 @@
* assert_select_rjs decodes escaped unicode chars since the Javascript generators encode them. #6240 [japgolly]
-* Deprecation: @cookies, @headers, @request will be removed after 1.2. Use the corresponding method instead. [Jeremy Kemper]
+* Deprecation: @cookies, @headers, @request, @response will be removed after 1.2. Use the corresponding method instead. [Jeremy Kemper]
* 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:
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index 5e5eab586c..a4b3a7314a 100755
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -304,7 +304,7 @@ module ActionController #:nodoc:
# <tt>response.headers["Cache-Control"] = "no-cache"</tt>. Can also be used to access the final body HTML after a template
# has been rendered through response.body -- useful for <tt>after_filter</tt>s that wants to manipulate the output,
# such as a OutputCompressionFilter.
- attr_accessor :response
+ attr_internal :response
# Holds a hash of objects in the session. Accessed like <tt>session[:person]</tt> to get the object tied to the "person"
# key. The session will hold any type of object as values, but the key should be a string or symbol.
@@ -1016,14 +1016,14 @@ module ActionController #:nodoc:
def assign_shortcuts(request, response)
@_request, @_params, @_cookies = request, request.parameters, request.cookies
- @response = response
- @response.session = request.session
+ @_response = response
+ @_response.session = request.session
- @_session = @response.session
- @template = @response.template
- @assigns = @response.template.assigns
+ @_session = @_response.session
+ @template = @_response.template
+ @assigns = @_response.template.assigns
- @_headers = @response.headers
+ @_headers = @_response.headers
assign_deprecated_shortcuts(request, response)
end
@@ -1128,8 +1128,9 @@ module ActionController #:nodoc:
%w(@assigns @performed_redirect @performed_render)
else
%w(@assigns @performed_redirect @performed_render
- @_request @request @response @_params @params @_session @session
- @_cookies @cookies @template @request_origin @parent_controller)
+ @_request @request @_response @response @_params @params
+ @_session @session @_cookies @cookies
+ @template @request_origin @parent_controller)
end
end
diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb
index 491d7d7d0c..e7782d3e22 100644
--- a/actionpack/lib/action_controller/caching.rb
+++ b/actionpack/lib/action_controller/caching.rb
@@ -125,17 +125,17 @@ module ActionController #:nodoc:
end
end
- # Manually cache the +content+ in the key determined by +options+. If no content is provided, the contents of @response.body is used
+ # Manually cache the +content+ in the key determined by +options+. If no content is provided, the contents of response.body is used
# If no options are provided, the current +options+ for this action is used. Example:
# cache_page "I'm the cached content", :controller => "lists", :action => "show"
def cache_page(content = nil, options = {})
return unless perform_caching && caching_allowed
- self.class.cache_page(content || @response.body, url_for(options.merge({ :only_path => true, :skip_relative_url_root => true })))
+ self.class.cache_page(content || response.body, url_for(options.merge({ :only_path => true, :skip_relative_url_root => true })))
end
private
def caching_allowed
- !@request.post? && @response.headers['Status'] && @response.headers['Status'].to_i < 400
+ !@request.post? && response.headers['Status'] && response.headers['Status'].to_i < 400
end
end
@@ -184,7 +184,7 @@ module ActionController #:nodoc:
end
end
- class ActionCacheFilter #:nodoc:
+ class ActionCacheFilter #:nodoc:
def initialize(*actions, &block)
@actions = actions
end
diff --git a/actionpack/lib/action_controller/components.rb b/actionpack/lib/action_controller/components.rb
index 0515461910..a7f5be2e6a 100644
--- a/actionpack/lib/action_controller/components.rb
+++ b/actionpack/lib/action_controller/components.rb
@@ -126,11 +126,11 @@ module ActionController #:nodoc:
def component_response(options, reuse_response)
klass = component_class(options)
request = request_for_component(klass.controller_name, options)
- response = reuse_response ? @response : @response.dup
+ new_response = reuse_response ? response : response.dup
- klass.process_with_components(request, response, self)
+ klass.process_with_components(request, new_response, self)
end
-
+
# determine the controller class for the component request
def component_class(options)
if controller = options[:controller]
diff --git a/actionpack/lib/action_controller/cookies.rb b/actionpack/lib/action_controller/cookies.rb
index 67086a09cb..52423aa61b 100644
--- a/actionpack/lib/action_controller/cookies.rb
+++ b/actionpack/lib/action_controller/cookies.rb
@@ -33,7 +33,7 @@ module ActionController #:nodoc:
# Deprecated cookie writer method
def cookie(*options)
- @response.headers["cookie"] << CGI::Cookie.new(*options)
+ response.headers['cookie'] << CGI::Cookie.new(*options)
end
end
diff --git a/actionpack/lib/action_controller/layout.rb b/actionpack/lib/action_controller/layout.rb
index 338d5980ab..f6d687bd10 100644
--- a/actionpack/lib/action_controller/layout.rb
+++ b/actionpack/lib/action_controller/layout.rb
@@ -250,7 +250,7 @@ module ActionController #:nodoc:
erase_render_results
add_variables_to_assigns
@template.instance_variable_set("@content_for_layout", content_for_layout)
- @response.layout = layout
+ response.layout = layout
render_text(@template.render_file(layout, true), deprecated_status)
else
render_with_no_layout(options, deprecated_status, &block)
diff --git a/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml b/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml
index 82007ff5e6..d949ffc837 100644
--- a/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml
+++ b/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml
@@ -8,7 +8,7 @@
<% if false %>
<br /><br />
<% begin %>
- <%= form_tag(@request.request_uri, "method" => @request.method) %>
+ <%= form_tag(request.request_uri, "method" => request.method) %>
<input type="hidden" name="BP-RETRY" value="1" />
<% for key, values in params %>
@@ -26,7 +26,7 @@
<% end %>
<%
- request_parameters_without_action = @request.parameters.clone
+ request_parameters_without_action = request.parameters.clone
request_parameters_without_action.delete("action")
request_parameters_without_action.delete("controller")
@@ -37,8 +37,8 @@
<p><b>Parameters</b>: <%=h request_dump == "{}" ? "None" : request_dump %></p>
<p><a href="#" onclick="document.getElementById('session_dump').style.display='block'; return false;">Show session dump</a></p>
-<div id="session_dump" style="display:none"><%= debug(@request.session.instance_variable_get("@data")) %></div>
+<div id="session_dump" style="display:none"><%= debug(request.session.instance_variable_get("@data")) %></div>
<h2 style="margin-top: 30px">Response</h2>
-<b>Headers</b>: <%=h @response.headers.inspect.gsub(/,/, ",\n") %><br/>
+<b>Headers</b>: <%=h response.headers.inspect.gsub(/,/, ",\n") %><br/>
diff --git a/actionpack/lib/action_controller/templates/rescues/template_error.rhtml b/actionpack/lib/action_controller/templates/rescues/template_error.rhtml
index 2cf812cd5f..827d66467d 100644
--- a/actionpack/lib/action_controller/templates/rescues/template_error.rhtml
+++ b/actionpack/lib/action_controller/templates/rescues/template_error.rhtml
@@ -1,6 +1,6 @@
<h1>
<%=h @exception.original_exception.class.to_s %> in
- <%=h @request.parameters["controller"].capitalize if @request.parameters["controller"]%>#<%=h @request.parameters["action"] %>
+ <%=h request.parameters["controller"].capitalize if request.parameters["controller"]%>#<%=h request.parameters["action"] %>
</h1>
<p>
diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_response_ivar.rhtml b/actionpack/test/fixtures/deprecated_instance_variables/_response_ivar.rhtml
new file mode 100644
index 0000000000..2f12d2ce32
--- /dev/null
+++ b/actionpack/test/fixtures/deprecated_instance_variables/_response_ivar.rhtml
@@ -0,0 +1 @@
+<%= @response.body %>
diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_response_method.rhtml b/actionpack/test/fixtures/deprecated_instance_variables/_response_method.rhtml
new file mode 100644
index 0000000000..948c75929a
--- /dev/null
+++ b/actionpack/test/fixtures/deprecated_instance_variables/_response_method.rhtml
@@ -0,0 +1 @@
+<%= response.body %>