From c0a372ba87f556769b98a6d06e8c684c3c3156df Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 28 Apr 2009 23:29:29 -0500 Subject: Deprecate template, session, assigns, and layout accessors on response object. Instead access them through the controller instance. This mainly affects functional test assertions. --- actionpack/lib/action_dispatch/http/response.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_dispatch/http/response.rb') diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index f570b8e8ed..d104dcb8a0 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -34,20 +34,30 @@ module ActionDispatch # :nodoc: DEFAULT_HEADERS = { "Cache-Control" => "no-cache" } attr_accessor :request - attr_accessor :template, :layout attr_accessor :redirected_to, :redirected_to_method_params attr_writer :header alias_method :headers=, :header= + def template + ActiveSupport::Deprecation.warn("response.template has been deprecated. Use controller.template instead", caller) + @template + end + attr_writer :template + def session ActiveSupport::Deprecation.warn("response.session has been deprecated. Use request.session instead", caller) - request.session + @request.session end def assigns ActiveSupport::Deprecation.warn("response.assigns has been deprecated. Use controller.assigns instead", caller) - template.assigns + @template.controller.assigns + end + + def layout + ActiveSupport::Deprecation.warn("response.layout has been deprecated. Use template.layout instead", caller) + @template.layout end delegate :default_charset, :to => 'ActionController::Base' -- cgit v1.2.3