aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-09-29 08:12:16 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-09-29 08:12:16 +0000
commitd7b5b44a0e6fddb772c1c0779489c17e1caa4a39 (patch)
tree2e9fc5e410264e970d086d9d8754af5cdf55681e
parent4f3bf6cb23991af8fac69b67dc73844f6a92205e (diff)
downloadrails-d7b5b44a0e6fddb772c1c0779489c17e1caa4a39.tar.gz
rails-d7b5b44a0e6fddb772c1c0779489c17e1caa4a39.tar.bz2
rails-d7b5b44a0e6fddb772c1c0779489c17e1caa4a39.zip
Deprecate @headers
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5206 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/CHANGELOG2
-rwxr-xr-xactionpack/lib/action_controller/base.rb8
-rw-r--r--actionpack/lib/action_controller/streaming.rb4
-rw-r--r--actionpack/test/fixtures/deprecated_instance_variables/_headers_ivar.rhtml1
-rw-r--r--actionpack/test/fixtures/deprecated_instance_variables/_headers_method.rhtml1
5 files changed, 9 insertions, 7 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 24ef8d01a1..ceec53145b 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, @request will be removed after 1.2. Use the corresponding method instead. [Jeremy Kemper]
+* Deprecation: @cookies, @headers, @request 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 02d731c4c8..5e5eab586c 100755
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -312,7 +312,7 @@ module ActionController #:nodoc:
# Holds a hash of header names and values. Accessed like <tt>headers["Cache-Control"]</tt> to get the value of the Cache-Control
# directive. Values should always be specified as strings.
- attr_accessor :headers
+ attr_internal :headers
# Holds the hash of variables that are passed on to the template class to be made available to the view. This hash
# is generated by taking a snapshot of all the instance variables in the current scope just before a template is rendered.
@@ -1019,18 +1019,18 @@ module ActionController #:nodoc:
@response = response
@response.session = request.session
- @_session = @response.session
+ @_session = @response.session
@template = @response.template
@assigns = @response.template.assigns
- @headers = @response.headers
+ @_headers = @response.headers
assign_deprecated_shortcuts(request, response)
end
# TODO: assigns cookies headers params request response template
- DEPRECATED_INSTANCE_VARIABLES = %w(cookies flash params request session)
+ DEPRECATED_INSTANCE_VARIABLES = %w(cookies flash headers params request session)
# Gone after 1.2.
def assign_deprecated_shortcuts(request, response)
diff --git a/actionpack/lib/action_controller/streaming.rb b/actionpack/lib/action_controller/streaming.rb
index 51bede19c0..484913c7df 100644
--- a/actionpack/lib/action_controller/streaming.rb
+++ b/actionpack/lib/action_controller/streaming.rb
@@ -119,7 +119,7 @@ module ActionController #:nodoc:
disposition <<= %(; filename="#{options[:filename]}") if options[:filename]
- @headers.update(
+ headers.update(
'Content-Length' => options[:length],
'Content-Type' => options[:type].strip, # fixes a problem with extra '\r' with some browsers
'Content-Disposition' => disposition,
@@ -132,7 +132,7 @@ module ActionController #:nodoc:
# after it displays the "open/save" dialog, which means that if you
# hit "open" the file isn't there anymore when the application that
# is called for handling the download is run, so let's workaround that
- @headers['Cache-Control'] = 'private' if @headers['Cache-Control'] == 'no-cache'
+ headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'
end
end
end
diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_headers_ivar.rhtml b/actionpack/test/fixtures/deprecated_instance_variables/_headers_ivar.rhtml
new file mode 100644
index 0000000000..1176c93ad8
--- /dev/null
+++ b/actionpack/test/fixtures/deprecated_instance_variables/_headers_ivar.rhtml
@@ -0,0 +1 @@
+<%= @headers[:test] %>
diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_headers_method.rhtml b/actionpack/test/fixtures/deprecated_instance_variables/_headers_method.rhtml
new file mode 100644
index 0000000000..308c4eb6ba
--- /dev/null
+++ b/actionpack/test/fixtures/deprecated_instance_variables/_headers_method.rhtml
@@ -0,0 +1 @@
+<%= headers[:test] %>