From 20baeece919629b7e43b86aebb05f8e2af6d19ef Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sun, 15 Jan 2012 23:21:08 -0200 Subject: Add some deprecations for logic being removed in 4.0 --- actionpack/lib/action_controller/metal/compatibility.rb | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 05dca445a4..76292db0b3 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -1,3 +1,5 @@ +require 'active_support/deprecation' + module ActionController module Compatibility extend ActiveSupport::Concern @@ -24,13 +26,19 @@ module ActionController ) def rescue_action(env) + ActiveSupport::Deprecation.warn "Calling `rescue_action` is deprecated and will be removed in Rails 4.0.", caller raise env["action_dispatch.rescue.exception"] end end # For old tests - def initialize_template_class(*) end - def assign_shortcuts(*) end + def initialize_template_class(*) + ActiveSupport::Deprecation.warn "Calling `initialize_template_class` is deprecated and has no effect anymore.", caller + end + + def assign_shortcuts(*) + ActiveSupport::Deprecation.warn "Calling `assign_shortcuts` is deprecated and has no effect anymore.", caller + end def _normalize_options(options) options[:text] = nil if options.delete(:nothing) == true @@ -44,6 +52,9 @@ module ActionController end def _handle_method_missing + ActiveSupport::Deprecation.warn "Using `method_missing` to handle non" \ + " existing actions is deprecated and will be removed in Rails 4.0, " \ + " please use `action_missing` instead.", caller method_missing(@_action_name.to_sym) end @@ -52,6 +63,8 @@ module ActionController end def performed? + ActiveSupport::Deprecation.warn "Calling `performed?` is deprecated and will " \ + "be removed in Rails 4.0. Please check for `response_body` presence instead.", caller response_body end end -- cgit v1.2.3 From 57be2cfa1eb5cf04c86f4ab5461f6903df099b98 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 17 Jan 2012 09:29:00 -0200 Subject: Deprecate default_charset= at controller level --- actionpack/lib/action_controller/metal/compatibility.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 76292db0b3..21626fde44 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -16,8 +16,10 @@ module ActionController # should be able to handle SCRIPT_NAME self.config.relative_url_root = ENV['RAILS_RELATIVE_URL_ROOT'] - class << self - delegate :default_charset=, :to => "ActionDispatch::Response" + def self.default_charset=(new_charset) + ActiveSupport::Deprecation.warn "Setting default charset at controller level" \ + " is deprecated, please use `config.action_dispatch.default_charset` instead", caller + ActionDispatch::Response.default_charset = new_charset end self.protected_instance_variables = %w( -- cgit v1.2.3 From 9d4fd613a69378b38b061580e6b979e61fe9a823 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 17 Jan 2012 08:56:50 -0200 Subject: Add default charset config to ActionDispatch --- actionpack/lib/action_dispatch/railtie.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/railtie.rb b/actionpack/lib/action_dispatch/railtie.rb index a4f4825f92..2bfeeb348f 100644 --- a/actionpack/lib/action_dispatch/railtie.rb +++ b/actionpack/lib/action_dispatch/railtie.rb @@ -11,6 +11,7 @@ module ActionDispatch config.action_dispatch.ignore_accept_header = false config.action_dispatch.rescue_templates = { } config.action_dispatch.rescue_responses = { } + config.action_dispatch.default_charset = nil config.action_dispatch.rack_cache = { :metastore => "rails:/", @@ -21,7 +22,7 @@ module ActionDispatch initializer "action_dispatch.configure" do |app| ActionDispatch::Http::URL.tld_length = app.config.action_dispatch.tld_length ActionDispatch::Request.ignore_accept_header = app.config.action_dispatch.ignore_accept_header - ActionDispatch::Response.default_charset = app.config.encoding + ActionDispatch::Response.default_charset = app.config.action_dispatch.default_charset || app.config.encoding ActionDispatch::ExceptionWrapper.rescue_responses.merge!(config.action_dispatch.rescue_responses) ActionDispatch::ExceptionWrapper.rescue_templates.merge!(config.action_dispatch.rescue_templates) -- cgit v1.2.3 From e5e87041ceafc64d11a01e5a1c7ce1f978a788a6 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 17 Jan 2012 09:58:52 -0200 Subject: Deprecate AC::UnknownError and AC::DoubleRenderError Use the constants AbstractController::ActionNotFound and AbstractController::DoubleRenderError respectively instead. --- actionpack/lib/action_controller/metal/compatibility.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 21626fde44..9895b2b4b5 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -9,8 +9,8 @@ module ActionController # Temporary hax included do - ::ActionController::UnknownAction = ::AbstractController::ActionNotFound - ::ActionController::DoubleRenderError = ::AbstractController::DoubleRenderError + ::ActionController::UnknownAction = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('ActionController::UnknownAction', '::AbstractController::ActionNotFound') + ::ActionController::DoubleRenderError = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('ActionController::DoubleRenderError', '::AbstractController::DoubleRenderError') # ROUTES TODO: This should be handled by a middleware and route generation # should be able to handle SCRIPT_NAME -- cgit v1.2.3 From 786a0b74754194aa893497ff60f0d60a56404e5a Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 17 Jan 2012 10:02:14 -0200 Subject: Remove duplicated constant definition ActionController::ActionControllerError is already defined in action_controller/metal/exceptions. --- actionpack/lib/action_controller/metal/compatibility.rb | 3 --- 1 file changed, 3 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 9895b2b4b5..7b73f86584 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -4,9 +4,6 @@ module ActionController module Compatibility extend ActiveSupport::Concern - class ::ActionController::ActionControllerError < StandardError #:nodoc: - end - # Temporary hax included do ::ActionController::UnknownAction = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('ActionController::UnknownAction', '::AbstractController::ActionNotFound') -- cgit v1.2.3