Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate alias_method_chain in favour of Module#prepend #19434

Merged
merged 1 commit into from Mar 22, 2015

Conversation

Projects
None yet
4 participants
@kirs
Copy link
Member

kirs commented Mar 20, 2015

…as discussed #19413
@rafaelfranca

@rafaelfranca

This comment has been minimized.

Copy link
Member

rafaelfranca commented Mar 20, 2015

We are still using it internally right? Lets remove all the calls before deprecating.

@@ -21,6 +21,8 @@ class Module
#
# so you can safely chain foo, foo?, foo! and/or foo= with the same feature.
def alias_method_chain(target, feature)
ActiveSupport::Deprecation.warn("alias_method_chain is deprecated. Please, use Module#prepend instead.")

This comment has been minimized.

@kaspth

kaspth Mar 20, 2015

Member

alias_method_chain is usually used to extend an existing method and call the original. This deprecation method leaves the last part implicit. Let's mention you can access the original method using super.

@kirs

This comment has been minimized.

Copy link
Member Author

kirs commented Mar 22, 2015

@rafaelfranca done.

Now there still 2 places where alias_method_chain is called:

@rafaelfranca

This comment has been minimized.

Copy link
Member

rafaelfranca commented Mar 22, 2015

@kirs in Rage core_ext lets remove the usage of alias_method_chain with its implementation, so we don't get deprecation warnings in our test, and add a TODO note to remove it as soon the bug is fixed.

@kirs

This comment has been minimized.

Copy link
Member Author

kirs commented Mar 22, 2015

rafaelfranca added a commit that referenced this pull request Mar 22, 2015

Merge pull request #19434 from kirs/deprecate-alias-method-chain
Deprecate alias_method_chain in favour of Module#prepend

@rafaelfranca rafaelfranca merged commit 4ba9c55 into rails:master Mar 22, 2015

@dhh

This comment has been minimized.

Copy link
Member

dhh commented Mar 24, 2015

I don't see how this is a replacement? Prepend operates on the whole module, requires the method that's beind prepended to call super. If we would have gotten the proposed features of before/after/around, that would have been a straight up replacement. This isn't.

@rafaelfranca

This comment has been minimized.

Copy link
Member

rafaelfranca commented Mar 24, 2015

@dhh the method that call super is the method that is extending, the original method don't need to take care of it. Could you show an example where prepend doesn't work?

@rafaelfranca

This comment has been minimized.

Copy link
Member

rafaelfranca commented Mar 24, 2015

When we proposed prepend to Ruby core was with the idea of being a complete replacement for alias_method_chain. I may be missing a case where prepend doesn't work, but I always could replace alias_method_chain with prepend without touching the original method.

@dhh

This comment has been minimized.

Copy link
Member

dhh commented Mar 24, 2015

Ah, okay, maybe I missed that. I’ll have another look.

On Mar 24, 2015, at 10:37 AM, Rafael Mendonça França notifications@github.com wrote:

@dhh https://github.com/dhh the method that call super is the method that is extending, the original method don't need to take care of it. Could you show an example where prepend doesn't work?


Reply to this email directly or view it on GitHub #19434 (comment).

@rafaelfranca

This comment has been minimized.

Copy link
Member

rafaelfranca commented Mar 24, 2015

Right. Let me know if you find a case, so we can remove the deprecation.

@@ -1,3 +1,7 @@
* Deprecate `alias_method_chain` in favour of `Module#prepend` introduced in Ruby 2.0

This comment has been minimized.

@kaspth

kaspth Mar 24, 2015

Member

@kirs Rails tries to stick to american english, so next time prefer favor over favour etc. 😄

@jasnow jasnow referenced this pull request Sep 18, 2015

Merged

Rails 5 Support #3714

@badlamer badlamer referenced this pull request Oct 26, 2016

Merged

remove rails 5 deprecation #8

@two-pack two-pack referenced this pull request Jun 6, 2017

Closed

stack level too deep error #41

@Erowlin Erowlin referenced this pull request Aug 30, 2017

Open

Rails 5 Issue #61

GabrielSandoval pushed a commit to GabrielSandoval/active_model_serializers_contrib that referenced this pull request Mar 13, 2018

Gabriel Sandoval
[#155929975] Remove #alias_method_chain
- #alias_method_chain has been deprecated in Rails 5
See: rails/rails#19434

GabrielSandoval pushed a commit to GabrielSandoval/active_model_serializers_contrib that referenced this pull request Mar 21, 2018

Gabriel Sandoval
[#155929975] Remove #alias_method_chain
- #alias_method_chain has been deprecated in Rails 5
See: rails/rails#19434

kamipo added a commit that referenced this pull request Jul 31, 2018

Remove unused require
"active_support/core_ext/module/aliasing" is no longer used since
#19434.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.