mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
deprecate the env method on controller instances
people should be accessing request information through the request object, not via the env hash. If they really really want at the env hash, then they can get it off the request.
This commit is contained in:
parent
869b007172
commit
05934d24af
3 changed files with 4 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
require 'active_support/core_ext/array/extract_options'
|
require 'active_support/core_ext/array/extract_options'
|
||||||
require 'action_dispatch/middleware/stack'
|
require 'action_dispatch/middleware/stack'
|
||||||
|
require 'active_support/deprecation'
|
||||||
|
|
||||||
module ActionController
|
module ActionController
|
||||||
# Extend ActionDispatch middleware stack to make it aware of options
|
# Extend ActionDispatch middleware stack to make it aware of options
|
||||||
|
@ -119,6 +120,7 @@ module ActionController
|
||||||
def env
|
def env
|
||||||
@_request.env
|
@_request.env
|
||||||
end
|
end
|
||||||
|
deprecate :env
|
||||||
|
|
||||||
# Returns the last part of the controller's name, underscored, without the ending
|
# Returns the last part of the controller's name, underscored, without the ending
|
||||||
# <tt>Controller</tt>. For instance, PostsController returns <tt>posts</tt>.
|
# <tt>Controller</tt>. For instance, PostsController returns <tt>posts</tt>.
|
||||||
|
|
|
@ -199,7 +199,7 @@ module ActionController #:nodoc:
|
||||||
def _process_options(options) #:nodoc:
|
def _process_options(options) #:nodoc:
|
||||||
super
|
super
|
||||||
if options[:stream]
|
if options[:stream]
|
||||||
if env["HTTP_VERSION"] == "HTTP/1.0"
|
if request.version == "HTTP/1.0"
|
||||||
options.delete(:stream)
|
options.delete(:stream)
|
||||||
else
|
else
|
||||||
headers["Cache-Control"] ||= "no-cache"
|
headers["Cache-Control"] ||= "no-cache"
|
||||||
|
|
|
@ -35,7 +35,7 @@ module ActionDispatch
|
||||||
HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING
|
HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING
|
||||||
HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_FROM
|
HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_FROM
|
||||||
HTTP_NEGOTIATE HTTP_PRAGMA HTTP_CLIENT_IP
|
HTTP_NEGOTIATE HTTP_PRAGMA HTTP_CLIENT_IP
|
||||||
HTTP_X_FORWARDED_FOR
|
HTTP_X_FORWARDED_FOR HTTP_VERSION
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
ENV_METHODS.each do |env|
|
ENV_METHODS.each do |env|
|
||||||
|
|
Loading…
Reference in a new issue