-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Remove Active Support deprecations #27035
Conversation
I'd remove them right now.
Yes. If they were deprecated in 5.0 should be removed in 5.1 |
Since Rails 5.0.0.1 in some cases did not point to the location of the deprecated code but instead pointed to the code where the deprecation warning was printed, what is the recommended path to find these last deprecations? Use the Example:
We only recently made the switch to 5.0 and didn't have time to find all deprecations within our dependencies (our own code doesn't have any). |
Great, thank you! I was unsure (and unable to find any information) about how Rails plans to release everything. |
I recently tried 5.0.1.rc1, and while 38 test cases now fail (I do not yet know why) I also don't see the correct location for all deprecations. Works (deprecation in Turbolinks Classic):
Doesn't work:
test_case.rb:484. I can't tell which test that is as I ran the whole suite. |
|
||
*Andrew White* | ||
|
||
* Remove deprecated file `active_support/core_ext/time/marshal.rb` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changelog is confusing here. It is better to say which methods were removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bogdan not sure what you mean - it was an empty file that was kept around so that it didn't break people's require statements so no methods were removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that there were some methods that were removed and asked to list those... but it looks like it is not the case. Thanks for explaination
…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.
…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.
…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.
This removes the deprecated methods, files and options from Active Support that were explicitly listed for removal from Rails 5.1 with two exceptions:
The qualified constant methods used two singleton methods from
ActiveSupport::QualifiedConstUtils
- should those be deprecated or just removed straight out since they're not used anywhere else in Rails and it's unlikely they were used in an application.The string callbacks and returning false are used elsewhere in the Rails test suite so I want to remove them in a separate PR.
Also there are methods with non-specific deprecations like
alias_method_chain
- is the plan to remove these in 5.1 also?