Skip to content
This repository
Browse code

Deprecate @headers

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5206 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit d7b5b44a0e6fddb772c1c0779489c17e1caa4a39 1 parent 4f3bf6c
Jeremy Kemper authored September 29, 2006
2  actionpack/CHANGELOG
@@ -2,7 +2,7 @@
2 2
 
3 3
 * assert_select_rjs decodes escaped unicode chars since the Javascript generators encode them.  #6240 [japgolly]
4 4
 
5  
-* Deprecation: @cookies, @request will be removed after 1.2. Use the corresponding method instead.  [Jeremy Kemper]
  5
+* Deprecation: @cookies, @headers, @request 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:
8 8
 
8  actionpack/lib/action_controller/base.rb
@@ -312,7 +312,7 @@ class Base
312 312
 
313 313
     # Holds a hash of header names and values. Accessed like <tt>headers["Cache-Control"]</tt> to get the value of the Cache-Control
314 314
     # directive. Values should always be specified as strings.
315  
-    attr_accessor :headers
  315
+    attr_internal :headers
316 316
 
317 317
     # Holds the hash of variables that are passed on to the template class to be made available to the view. This hash
318 318
     # 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 @@ def assign_shortcuts(request, response)
1019 1019
         @response         = response
1020 1020
         @response.session = request.session
1021 1021
 
1022  
-        @_session  = @response.session
  1022
+        @_session = @response.session
1023 1023
         @template = @response.template
1024 1024
         @assigns  = @response.template.assigns
1025 1025
 
1026  
-        @headers  = @response.headers
  1026
+        @_headers = @response.headers
1027 1027
 
1028 1028
         assign_deprecated_shortcuts(request, response)
1029 1029
       end
1030 1030
 
1031 1031
 
1032 1032
       # TODO: assigns cookies headers params request response template
1033  
-      DEPRECATED_INSTANCE_VARIABLES = %w(cookies flash params request session)
  1033
+      DEPRECATED_INSTANCE_VARIABLES = %w(cookies flash headers params request session)
1034 1034
 
1035 1035
       # Gone after 1.2.
1036 1036
       def assign_deprecated_shortcuts(request, response)
4  actionpack/lib/action_controller/streaming.rb
@@ -119,7 +119,7 @@ def send_file_headers!(options)
119 119
 
120 120
         disposition <<= %(; filename="#{options[:filename]}") if options[:filename]
121 121
 
122  
-        @headers.update(
  122
+        headers.update(
123 123
           'Content-Length'            => options[:length],
124 124
           'Content-Type'              => options[:type].strip,  # fixes a problem with extra '\r' with some browsers
125 125
           'Content-Disposition'       => disposition,
@@ -132,7 +132,7 @@ def send_file_headers!(options)
132 132
         # after it displays the "open/save" dialog, which means that if you 
133 133
         # hit "open" the file isn't there anymore when the application that 
134 134
         # is called for handling the download is run, so let's workaround that
135  
-        @headers['Cache-Control'] = 'private' if @headers['Cache-Control'] == 'no-cache'
  135
+        headers['Cache-Control'] = 'private' if headers['Cache-Control'] == 'no-cache'
136 136
       end
137 137
   end
138 138
 end
1  actionpack/test/fixtures/deprecated_instance_variables/_headers_ivar.rhtml
... ...
@@ -0,0 +1 @@
  1
+<%= @headers[:test] %>
1  actionpack/test/fixtures/deprecated_instance_variables/_headers_method.rhtml
... ...
@@ -0,0 +1 @@
  1
+<%= headers[:test] %>

0 notes on commit d7b5b44

Please sign in to comment.
Something went wrong with that request. Please try again.