diff options
author | kennyj <kennyj@gmail.com> | 2013-06-01 14:07:59 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2013-06-01 23:22:12 +0900 |
commit | d8c6f52d3b5971ed7541d1f6d92cac9e8f61f18c (patch) | |
tree | da9a87ad006295695153167756ebd29ee1c42107 | |
parent | dabb9d1c837cdaaab2ce8640120d20b96dbc3a8b (diff) | |
download | rails-d8c6f52d3b5971ed7541d1f6d92cac9e8f61f18c.tar.gz rails-d8c6f52d3b5971ed7541d1f6d92cac9e8f61f18c.tar.bz2 rails-d8c6f52d3b5971ed7541d1f6d92cac9e8f61f18c.zip |
Remove ActionController::RecordIdentifier was deprecated.
-rw-r--r-- | actionpack/lib/action_controller.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_controller/base.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_controller/record_identifier.rb | 31 | ||||
-rw-r--r-- | actionpack/test/controller/base_test.rb | 32 | ||||
-rw-r--r-- | actionpack/test/controller/record_identifier_test.rb | 34 |
5 files changed, 3 insertions, 99 deletions
diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb index 9cacb3862b..9fdad63b45 100644 --- a/actionpack/lib/action_controller.rb +++ b/actionpack/lib/action_controller.rb @@ -46,10 +46,6 @@ module ActionController autoload :TestCase, 'action_controller/test_case' autoload :TemplateAssertions, 'action_controller/test_case' - eager_autoload do - autoload :RecordIdentifier - end - def self.eager_load! super ActionController::Caching.eager_load! diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 971c4189c8..d7b09b67c0 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -223,7 +223,6 @@ module ActionController ForceSSL, Streaming, DataStreaming, - RecordIdentifier, HttpAuthentication::Basic::ControllerMethods, HttpAuthentication::Digest::ControllerMethods, HttpAuthentication::Token::ControllerMethods, diff --git a/actionpack/lib/action_controller/record_identifier.rb b/actionpack/lib/action_controller/record_identifier.rb deleted file mode 100644 index d598bac467..0000000000 --- a/actionpack/lib/action_controller/record_identifier.rb +++ /dev/null @@ -1,31 +0,0 @@ -require 'action_view/record_identifier' - -module ActionController - module RecordIdentifier - MODULE_MESSAGE = 'Calling ActionController::RecordIdentifier.%s is deprecated and ' \ - 'will be removed in Rails 4.1, please call using ActionView::RecordIdentifier instead.' - INSTANCE_MESSAGE = '%s method will no longer be included by default in controllers ' \ - 'since Rails 4.1. If you would like to use it in controllers, please include ' \ - 'ActionView::RecordIdentifier module.' - - def dom_id(record, prefix = nil) - ActiveSupport::Deprecation.warn(INSTANCE_MESSAGE % 'dom_id') - ActionView::RecordIdentifier.dom_id(record, prefix) - end - - def dom_class(record, prefix = nil) - ActiveSupport::Deprecation.warn(INSTANCE_MESSAGE % 'dom_class') - ActionView::RecordIdentifier.dom_class(record, prefix) - end - - def self.dom_id(record, prefix = nil) - ActiveSupport::Deprecation.warn(MODULE_MESSAGE % 'dom_id') - ActionView::RecordIdentifier.dom_id(record, prefix) - end - - def self.dom_class(record, prefix = nil) - ActiveSupport::Deprecation.warn(MODULE_MESSAGE % 'dom_class') - ActionView::RecordIdentifier.dom_class(record, prefix) - end - end -end diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb index d4f18d55a6..b2bfdae174 100644 --- a/actionpack/test/controller/base_test.rb +++ b/actionpack/test/controller/base_test.rb @@ -61,10 +61,7 @@ class UrlOptionsController < ActionController::Base end end -class RecordIdentifierController < ActionController::Base -end - -class RecordIdentifierWithoutDeprecationController < ActionController::Base +class RecordIdentifierIncludedController < ActionController::Base include ActionView::RecordIdentifier end @@ -88,43 +85,20 @@ class ControllerClassTests < ActiveSupport::TestCase assert_equal 'contained_empty', Submodule::ContainedEmptyController.controller_name end - def test_record_identifier - assert_respond_to RecordIdentifierController.new, :dom_id - assert_respond_to RecordIdentifierController.new, :dom_class - end - - def test_record_identifier_is_deprecated - record = Comment.new - record.save - - dom_id = nil - assert_deprecated 'dom_id method will no longer' do - dom_id = RecordIdentifierController.new.dom_id(record) - end - - assert_equal 'comment_1', dom_id - - dom_class = nil - assert_deprecated 'dom_class method will no longer' do - dom_class = RecordIdentifierController.new.dom_class(record) - end - assert_equal 'comment', dom_class - end - def test_no_deprecation_when_action_view_record_identifier_is_included record = Comment.new record.save dom_id = nil assert_not_deprecated do - dom_id = RecordIdentifierWithoutDeprecationController.new.dom_id(record) + dom_id = RecordIdentifierIncludedController.new.dom_id(record) end assert_equal 'comment_1', dom_id dom_class = nil assert_not_deprecated do - dom_class = RecordIdentifierWithoutDeprecationController.new.dom_class(record) + dom_class = RecordIdentifierIncludedController.new.dom_class(record) end assert_equal 'comment', dom_class end diff --git a/actionpack/test/controller/record_identifier_test.rb b/actionpack/test/controller/record_identifier_test.rb deleted file mode 100644 index ff5d7fd3bd..0000000000 --- a/actionpack/test/controller/record_identifier_test.rb +++ /dev/null @@ -1,34 +0,0 @@ -require 'abstract_unit' -require 'controller/fake_models' - -class ControllerRecordIdentifierTest < ActiveSupport::TestCase - include ActionController::RecordIdentifier - - def setup - @record = Comment.new - end - - def test_dom_id_deprecation - assert_deprecated(/dom_id method will no longer be included by default in controllers/) do - dom_id(@record) - end - end - - def test_dom_class_deprecation - assert_deprecated(/dom_class method will no longer be included by default in controllers/) do - dom_class(@record) - end - end - - def test_dom_id_from_module_deprecation - assert_deprecated(/Calling ActionController::RecordIdentifier.dom_id is deprecated/) do - ActionController::RecordIdentifier.dom_id(@record) - end - end - - def test_dom_class_from_module_deprecation - assert_deprecated(/Calling ActionController::RecordIdentifier.dom_class is deprecated/) do - ActionController::RecordIdentifier.dom_class(@record) - end - end -end |