Permalink
Browse files

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.
  • Loading branch information...
tenderlove committed Aug 7, 2015
1 parent 869b007 commit 05934d24aff62d66fc62621aa38dae6456e276be
@@ -1,5 +1,6 @@
require 'active_support/core_ext/array/extract_options'
require 'action_dispatch/middleware/stack'
require 'active_support/deprecation'
module ActionController
# Extend ActionDispatch middleware stack to make it aware of options
@@ -119,6 +120,7 @@ class Metal < AbstractController::Base
def env
@_request.env
end
deprecate :env
# Returns the last part of the controller's name, underscored, without the ending
# <tt>Controller</tt>. For instance, PostsController returns <tt>posts</tt>.
@@ -199,7 +199,7 @@ module Streaming
def _process_options(options) #:nodoc:
super
if options[:stream]
if env["HTTP_VERSION"] == "HTTP/1.0"
if request.version == "HTTP/1.0"
options.delete(:stream)
else
headers["Cache-Control"] ||= "no-cache"
@@ -35,7 +35,7 @@ class Request < Rack::Request
HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING
HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_FROM
HTTP_NEGOTIATE HTTP_PRAGMA HTTP_CLIENT_IP
HTTP_X_FORWARDED_FOR
HTTP_X_FORWARDED_FOR HTTP_VERSION
].freeze
ENV_METHODS.each do |env|

0 comments on commit 05934d2

Please sign in to comment.