Deprecate @headers

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5206 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2006-09-29 08:12:16 +00:00
parent 4f3bf6cb23
commit d7b5b44a0e
5 changed files with 9 additions and 7 deletions

@ -2,7 +2,7 @@
* assert_select_rjs decodes escaped unicode chars since the Javascript generators encode them. #6240 [japgolly] * 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: * 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:

@ -312,7 +312,7 @@ class Base
# Holds a hash of header names and values. Accessed like <tt>headers["Cache-Control"]</tt> to get the value of the Cache-Control # 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. # 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 # 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. # 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)
@response = response @response = response
@response.session = request.session @response.session = request.session
@_session = @response.session @_session = @response.session
@template = @response.template @template = @response.template
@assigns = @response.template.assigns @assigns = @response.template.assigns
@headers = @response.headers @_headers = @response.headers
assign_deprecated_shortcuts(request, response) assign_deprecated_shortcuts(request, response)
end end
# TODO: assigns cookies headers params request response template # 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. # Gone after 1.2.
def assign_deprecated_shortcuts(request, response) def assign_deprecated_shortcuts(request, response)

@ -119,7 +119,7 @@ def send_file_headers!(options)
disposition <<= %(; filename="#{options[:filename]}") if options[:filename] disposition <<= %(; filename="#{options[:filename]}") if options[:filename]
@headers.update( headers.update(
'Content-Length' => options[:length], 'Content-Length' => options[:length],
'Content-Type' => options[:type].strip, # fixes a problem with extra '\r' with some browsers 'Content-Type' => options[:type].strip, # fixes a problem with extra '\r' with some browsers
'Content-Disposition' => disposition, 'Content-Disposition' => disposition,
@ -132,7 +132,7 @@ def send_file_headers!(options)
# after it displays the "open/save" dialog, which means that if you # after it displays the "open/save" dialog, which means that if you
# hit "open" the file isn't there anymore when the application that # 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 # 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 end
end end

@ -0,0 +1 @@
<%= @headers[:test] %>

@ -0,0 +1 @@
<%= headers[:test] %>