diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-04-28 16:54:09 +1200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-04-28 16:54:09 +1200 |
commit | 8af98c3f8143d7086e15d4938fd56512ed584f2e (patch) | |
tree | 2c87118a5ccd0f79ac6c4e10a9e7c374515e21d5 | |
parent | be48cad9a41ebf88ae19f2381a57917d532734c9 (diff) | |
download | rails-8af98c3f8143d7086e15d4938fd56512ed584f2e.tar.gz rails-8af98c3f8143d7086e15d4938fd56512ed584f2e.tar.bz2 rails-8af98c3f8143d7086e15d4938fd56512ed584f2e.zip |
Revert alias_method_chain exceptions as they broke aliasing class methods.
This reverts commit be48cad9a41ebf88ae19f2381a57917d532734c9.
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/aliasing.rb | 4 | ||||
-rw-r--r-- | activesupport/test/core_ext/module_test.rb | 15 |
2 files changed, 1 insertions, 18 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/aliasing.rb b/activesupport/lib/active_support/core_ext/module/aliasing.rb index cb7d4c1c3c..1894e3b0a2 100644 --- a/activesupport/lib/active_support/core_ext/module/aliasing.rb +++ b/activesupport/lib/active_support/core_ext/module/aliasing.rb @@ -28,10 +28,6 @@ class Module with_method, without_method = "#{aliased_target}_with_#{feature}#{punctuation}", "#{aliased_target}_without_#{feature}#{punctuation}" - if method_defined?(without_method) || private_method_defined?(without_method) - raise NameError, "#{with_method} is already in #{target}'s alias chain." - end - alias_method without_method, target alias_method target, with_method diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index d983044fc3..ecdea38d44 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -166,19 +166,6 @@ class MethodAliasingTest < Test::Unit::TestCase assert_equal 'bar_with_baz', @instance.bar assert_equal 'bar', @instance.bar_without_baz end - - def test_alias_method_chain_complains_the_second_time - FooClassWithBarMethod.class_eval do - def bar_with_magic; end - alias_method_chain :bar, :magic - end - - assert_raise(NameError) do - FooClassWithBarMethod.class_eval do - alias_method_chain :bar, :magic - end - end - end def test_alias_method_chain_with_punctuation_method FooClassWithBarMethod.class_eval do @@ -302,5 +289,5 @@ class MethodAliasingTest < Test::Unit::TestCase assert_equal 'duck_with_orange', @instance.duck assert FooClassWithBarMethod.public_method_defined?(:duck) - end + end end |