Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
alias_method_chain has been deprecated and removed in rails 5.1 (see r…
…ails/rails#27035) Apparently, defining methods such as :a_with_b and :a_without_b used to be a common pattern in rails, so alias_method_chain was introduced to encapsulate this (see: https://apidock.com/rails/ActiveSupport/CoreExtensions/Module/alias_method_chain). Here is an example of how this works and how we can replace alias_method_chain with alias_method: class DeprecatedPerson def greet "hi" end def greet_with_excitement "#{greet_without_excitement}!!!!!" end alias_method_chain :greet, :excitement end class Person def greet "hi" end def greet_with_excitement "#{greet_without_excitement}!!!!!" end alias_method :greet_without_excitement, :greet alias_method :greet, :greet_with_excitement end tracy = DeprecatedPerson.new tracy.greet # => "hi!!!!!" tracy.greet_with_excitement # => "hi!!!!!" tracy.greet_without_excitement # => "hi" june = Person.new june.greet # => "hi!!!!!" june.greet_with_excitement # => "hi!!!!!" june.greet_without_excitement # => "hi" It is necessary to replace alias_method_chain because we use this gem in the inventables/fbolt repo, and it may take some time to rewrite fbolt such that this gem is no longer be a dependency. Meanwhile, we are encountering deprecation warnings which are quite noisy. Before upgrading from rails 5.0 to 5.1, we will have to address each of the dependencies that still use alias_method_chain.
- Loading branch information