From 05934d24aff62d66fc62621aa38dae6456e276be Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 7 Aug 2015 16:27:32 -0700 Subject: 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. --- actionpack/lib/action_controller/metal.rb | 2 ++ actionpack/lib/action_controller/metal/streaming.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_controller') diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb index 82e543e033..914b0d4b30 100644 --- a/actionpack/lib/action_controller/metal.rb +++ b/actionpack/lib/action_controller/metal.rb @@ -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 @@ module ActionController def env @_request.env end + deprecate :env # Returns the last part of the controller's name, underscored, without the ending # Controller. For instance, PostsController returns posts. diff --git a/actionpack/lib/action_controller/metal/streaming.rb b/actionpack/lib/action_controller/metal/streaming.rb index af31de1f3a..a6115674aa 100644 --- a/actionpack/lib/action_controller/metal/streaming.rb +++ b/actionpack/lib/action_controller/metal/streaming.rb @@ -199,7 +199,7 @@ module ActionController #:nodoc: 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" -- cgit v1.2.3