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 - Class#superclass_delegating_accessor #14271

Merged
merged 1 commit into from Mar 20, 2014

Conversation

Projects
None yet
7 participants
@akshay-vishnoi
Contributor

akshay-vishnoi commented Mar 4, 2014

class TestClass
  superclass_delegating_accessor :test_attribute
end

# Before
TestClass.private_methods.include?(:_test_attribute) # => false
TestClass.private_methods.include?(:_test_attribute=) # => false

# After
TestClass.private_methods.include?(:_test_attribute) # => true
TestClass.private_methods.include?(:_test_attribute=) # => true
@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 5, 2014

Contributor

Any update on this?

Contributor

akshay-vishnoi commented Mar 5, 2014

Any update on this?

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi
Contributor

akshay-vishnoi commented Mar 5, 2014

@chancancode

This comment has been minimized.

Show comment
Hide comment
@chancancode

chancancode Mar 6, 2014

Member

Sorry, I must be missing some context here. What's the bug here? I am not familiar with this method and it has no docs. Is that even public API? Can you fill me in? Thanks 😄

Member

chancancode commented Mar 6, 2014

Sorry, I must be missing some context here. What's the bug here? I am not familiar with this method and it has no docs. Is that even public API? Can you fill me in? Thanks 😄

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 6, 2014

Contributor

@chancancode:

  1. Bug - Comment in Class#superclass_delegating_accessor says that this method creates private _name and _name= methods, which previously was not true. Refer here.

    Also test cases were not covering the whole functionality of Class#superclass_delegating_accessor.

  2. Yes it is in public API.

Contributor

akshay-vishnoi commented Mar 6, 2014

@chancancode:

  1. Bug - Comment in Class#superclass_delegating_accessor says that this method creates private _name and _name= methods, which previously was not true. Refer here.

    Also test cases were not covering the whole functionality of Class#superclass_delegating_accessor.

  2. Yes it is in public API.

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 7, 2014

Contributor

@chancancode Any update on this? 😄

Contributor

akshay-vishnoi commented Mar 7, 2014

@chancancode Any update on this? 😄

@chancancode

This comment has been minimized.

Show comment
Hide comment
@chancancode

chancancode Mar 7, 2014

Member

I still don't know what this method does =/

If it's a public API we should add docs? If not we should :nodoc it? You don't have to do those, but I don't feel comfortable merging this without understanding what this does. Maybe someone else more familiar with this can help you then :)

Member

chancancode commented Mar 7, 2014

I still don't know what this method does =/

If it's a public API we should add docs? If not we should :nodoc it? You don't have to do those, but I don't feel comfortable merging this without understanding what this does. Maybe someone else more familiar with this can help you then :)

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi
Contributor

akshay-vishnoi commented Mar 7, 2014

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 10, 2014

Contributor

Any update on this?

Contributor

akshay-vishnoi commented Mar 10, 2014

Any update on this?

@wycats

This comment has been minimized.

Show comment
Hide comment
@wycats

wycats Mar 10, 2014

Member

I'll take a look today.

Member

wycats commented Mar 10, 2014

I'll take a look today.

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 10, 2014

Contributor

Thanks @wycats

Contributor

akshay-vishnoi commented Mar 10, 2014

Thanks @wycats

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 12, 2014

Contributor

Any update on this?

Contributor

akshay-vishnoi commented Mar 12, 2014

Any update on this?

@thedarkone

This comment has been minimized.

Show comment
Hide comment
@thedarkone

thedarkone Mar 12, 2014

Contributor

I don't think superclass_delegating_accessor is used by Rails anymore, it also has no docs. So how about removing altogether?

Contributor

thedarkone commented Mar 12, 2014

I don't think superclass_delegating_accessor is used by Rails anymore, it also has no docs. So how about removing altogether?

@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Mar 12, 2014

Member

Definitely +1 for deprecating this.

Member

carlosantoniodasilva commented Mar 12, 2014

Definitely +1 for deprecating this.

@wycats

This comment has been minimized.

Show comment
Hide comment
@wycats

wycats Mar 12, 2014

Member

I'm pretty sure this was an earlier experiment before we settled on class_attribute. I see no reason to keep it around if it's not used anywhere.

Member

wycats commented Mar 12, 2014

I'm pretty sure this was an earlier experiment before we settled on class_attribute. I see no reason to keep it around if it's not used anywhere.

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 12, 2014

Contributor

Should I update the PR?
That means updated PR will include:

  1. Remove activesupport/lib/active_support/core_ext/class/delegating_attributes.rb and activesupport/test/core_ext/class/delegating_attributes_test.rb
  2. Remove the require statements from active_support/core_ext/class.rb and activerecord/lib/active_record/base.rb.
Contributor

akshay-vishnoi commented Mar 12, 2014

Should I update the PR?
That means updated PR will include:

  1. Remove activesupport/lib/active_support/core_ext/class/delegating_attributes.rb and activesupport/test/core_ext/class/delegating_attributes_test.rb
  2. Remove the require statements from active_support/core_ext/class.rb and activerecord/lib/active_record/base.rb.
@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Mar 13, 2014

Member

Please do, just add a deprecation now for master/4.2, and we remove in the next version. It's not gonna be a problem for Rails, but other libs might be using it in ways we don't know, so deprecating first is always better.

Member

carlosantoniodasilva commented Mar 13, 2014

Please do, just add a deprecation now for master/4.2, and we remove in the next version. It's not gonna be a problem for Rails, but other libs might be using it in ways we don't know, so deprecating first is always better.

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 13, 2014

Contributor

Okay I will add deprecation warning and corresponding test cases.
But I think we should update the code for master/4.2 because

  1. Previous code was not correct.
  2. Previous test cases were incorrectly written. (If we are not updating the code, but we should atleast cover all test cases.)

cc @carlosantoniodasilva, @wycats, @thedarkone - Any thoughts?

Contributor

akshay-vishnoi commented Mar 13, 2014

Okay I will add deprecation warning and corresponding test cases.
But I think we should update the code for master/4.2 because

  1. Previous code was not correct.
  2. Previous test cases were incorrectly written. (If we are not updating the code, but we should atleast cover all test cases.)

cc @carlosantoniodasilva, @wycats, @thedarkone - Any thoughts?

@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Mar 13, 2014

Member

I think it's not necessary to change code/tests we're going to rm, specially because we haven't received issues related to this piece of code in a long time as far as I remember. We can just go ahead and deprecate it as is. Thanks!

Member

carlosantoniodasilva commented Mar 13, 2014

I think it's not necessary to change code/tests we're going to rm, specially because we haven't received issues related to this piece of code in a long time as far as I remember. We can just go ahead and deprecate it as is. Thanks!

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 14, 2014

Contributor

Sorry for late reply. I will do it today. Thanks for help!!!

Contributor

akshay-vishnoi commented Mar 14, 2014

Sorry for late reply. I will do it today. Thanks for help!!!

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 19, 2014

Contributor

@carlosantoniodasilva Please check the updated code.

Contributor

akshay-vishnoi commented Mar 19, 2014

@carlosantoniodasilva Please check the updated code.

@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Mar 19, 2014

Member

Can you add a test that shows it's deprecated, and a changelog entry? It may also need to require the related deprecation file. Thanks.

Member

carlosantoniodasilva commented Mar 19, 2014

Can you add a test that shows it's deprecated, and a changelog entry? It may also need to require the related deprecation file. Thanks.

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 19, 2014

Contributor

@carlosantoniodasilva: Please check updated code.

  1. Test case added
  2. CHANGELOG.md updated
  3. deprecation file required

Thanks

Contributor

akshay-vishnoi commented Mar 19, 2014

@carlosantoniodasilva: Please check updated code.

  1. Test case added
  2. CHANGELOG.md updated
  3. deprecation file required

Thanks

@robin850

This comment has been minimized.

Show comment
Hide comment
@robin850

robin850 Mar 19, 2014

Member

@akshay-vishnoi : Could you please rebase your branch ? It doesn't apply cleanly. Also it would be nice if you could update the PR title and description accordingly. Thanks for your contribution! 👍

Member

robin850 commented Mar 19, 2014

@akshay-vishnoi : Could you please rebase your branch ? It doesn't apply cleanly. Also it would be nice if you could update the PR title and description accordingly. Thanks for your contribution! 👍

@akshay-vishnoi akshay-vishnoi changed the title from Bug Fix - Class#superclass_delegating_accessor to Deprecate - Class#superclass_delegating_accessor Mar 19, 2014

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 19, 2014

Contributor

@robin850

  1. I have done rebasing. Please check updated code.
  2. Also changed the title of PR.
  3. Should I change my comment as well, as description of PR is now shown as a comment?
Contributor

akshay-vishnoi commented Mar 19, 2014

@robin850

  1. I have done rebasing. Please check updated code.
  2. Also changed the title of PR.
  3. Should I change my comment as well, as description of PR is now shown as a comment?
@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Mar 19, 2014

Member

Looks good, however I think now other tests will show warnings when running the suite, maybe we should silence those?

Thanks @akshay-vishnoi

Member

carlosantoniodasilva commented Mar 19, 2014

Looks good, however I think now other tests will show warnings when running the suite, maybe we should silence those?

Thanks @akshay-vishnoi

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Mar 19, 2014

Member

If we are going to deprecate we need to tell our users what they have to use instead. I searched on GitHub and there are a lot of ocorrences of this method https://github.com/search?p=1&q=superclass_delegating_accessor&type=Code

Member

rafaelfranca commented Mar 19, 2014

If we are going to deprecate we need to tell our users what they have to use instead. I searched on GitHub and there are a lot of ocorrences of this method https://github.com/search?p=1&q=superclass_delegating_accessor&type=Code

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 19, 2014

Contributor

@rafaelfranca I am also working on it, I can extract a gem for this. So we can refer to it if necessary.

Contributor

akshay-vishnoi commented Mar 19, 2014

@rafaelfranca I am also working on it, I can extract a gem for this. So we can refer to it if necessary.

@thedarkone

This comment has been minimized.

Show comment
Hide comment
@thedarkone

thedarkone Mar 19, 2014

Contributor

@akshay-vishnoi the deprecation message should refer users to class_attribute.

If we are going to deprecate we need to tell our users what they have to use instead. I searched on GitHub and there are a lot of ocorrences of this method https://github.com/search?p=1&q=superclass_delegating_accessor&type=Code

@rafaelfranca wow, that's a lot of code... but clicking through random pages, it all looks to be either vendored Rails code or an old (also vendored) version of active_merchant.

Contributor

thedarkone commented Mar 19, 2014

@akshay-vishnoi the deprecation message should refer users to class_attribute.

If we are going to deprecate we need to tell our users what they have to use instead. I searched on GitHub and there are a lot of ocorrences of this method https://github.com/search?p=1&q=superclass_delegating_accessor&type=Code

@rafaelfranca wow, that's a lot of code... but clicking through random pages, it all looks to be either vendored Rails code or an old (also vendored) version of active_merchant.

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 19, 2014

Contributor

Could you please guide what should be the proper warning message? Thanks

Contributor

akshay-vishnoi commented Mar 19, 2014

Could you please guide what should be the proper warning message? Thanks

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Mar 19, 2014

Member

@akshay-vishnoi something like:

".superclass_delegating_accessor is deprecated and will be removed in the next Rails 4.2. Please use .class_attribute instead."

Member

rafaelfranca commented Mar 19, 2014

@akshay-vishnoi something like:

".superclass_delegating_accessor is deprecated and will be removed in the next Rails 4.2. Please use .class_attribute instead."

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 19, 2014

Contributor

@rafaelfranca - Code updated Please check
Now the message will be

DEPRECATION WARNING: superclass_delegating_accessor is deprecated and will be removed from Rails 4.2 (use class_attribute instead).
Contributor

akshay-vishnoi commented Mar 19, 2014

@rafaelfranca - Code updated Please check
Now the message will be

DEPRECATION WARNING: superclass_delegating_accessor is deprecated and will be removed from Rails 4.2 (use class_attribute instead).
@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Mar 19, 2014

Member

Ok, now we have to fix all the deprecations are being printed in our tests. See https://travis-ci.org/rails/rails/jobs/21113798#L2989 for example

Member

rafaelfranca commented Mar 19, 2014

Ok, now we have to fix all the deprecations are being printed in our tests. See https://travis-ci.org/rails/rails/jobs/21113798#L2989 for example

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 19, 2014

Contributor

@rafaelfranca : Could you please help, actually when I am running test cases it is showing the warning and full backtrace, but when I am using rails as a gem then it is not showing the backtrace but only warning. What could be the possible reason? Although all test cases are running and there is no error or failure, but I am not getting how to stop these backtraces.

Contributor

akshay-vishnoi commented Mar 19, 2014

@rafaelfranca : Could you please help, actually when I am running test cases it is showing the warning and full backtrace, but when I am using rails as a gem then it is not showing the backtrace but only warning. What could be the possible reason? Although all test cases are running and there is no error or failure, but I am not getting how to stop these backtraces.

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Mar 19, 2014

Member

You can use assert_deprecated or silence_warnings

Member

rafaelfranca commented Mar 19, 2014

You can use assert_deprecated or silence_warnings

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 19, 2014

Contributor

I have already used assert_deprecated and backtrace is not coming for this test, and if i have to stop it for all other test cases then i will need to change it at each place where Class#superclass_delegating_accessor is getting used.
I also noticed that ActiveSupport::Deprecation.debug is true here. Backtrace is coming due to this reason. If I set ActiveSupport::Deprecation.debug to false, then only warning message is coming, like other methods i.e. without any backtrace. Do you have any idea about this?
Thanks

Contributor

akshay-vishnoi commented Mar 19, 2014

I have already used assert_deprecated and backtrace is not coming for this test, and if i have to stop it for all other test cases then i will need to change it at each place where Class#superclass_delegating_accessor is getting used.
I also noticed that ActiveSupport::Deprecation.debug is true here. Backtrace is coming due to this reason. If I set ActiveSupport::Deprecation.debug to false, then only warning message is coming, like other methods i.e. without any backtrace. Do you have any idea about this?
Thanks

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 19, 2014

Contributor

Okay it has been set in abstract_unit.rb. But how can we escape the deprecation warning for this line or similar to this line? As these lines are not the part of the test cases.

Contributor

akshay-vishnoi commented Mar 19, 2014

Okay it has been set in abstract_unit.rb. But how can we escape the deprecation warning for this line or similar to this line? As these lines are not the part of the test cases.

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Mar 19, 2014

Member

I think you can use silence_warnings for that case.

Member

rafaelfranca commented Mar 19, 2014

I think you can use silence_warnings for that case.

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 19, 2014

Contributor

@rafaelfranca : Please check updated code. Will this work?

Contributor

akshay-vishnoi commented Mar 19, 2014

@rafaelfranca : Please check updated code. Will this work?

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 20, 2014

Contributor

@rafaelfranca : Any updates?

Contributor

akshay-vishnoi commented Mar 20, 2014

@rafaelfranca : Any updates?

@carlosantoniodasilva

View changes

Show outdated Hide outdated activesupport/CHANGELOG.md
@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Mar 20, 2014

Member

@akshay-vishnoi just a minor comment on the changelog, and then we're good to go.

Member

carlosantoniodasilva commented Mar 20, 2014

@akshay-vishnoi just a minor comment on the changelog, and then we're good to go.

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 20, 2014

Contributor

@carlosantoniodasilva Ya sure, Updating!!!!

Contributor

akshay-vishnoi commented Mar 20, 2014

@carlosantoniodasilva Ya sure, Updating!!!!

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 20, 2014

Contributor

@carlosantoniodasilva : Code updated Please check.
When are we expecting next stable release, so that I can make another PR removing the same from the codebase?

Contributor

akshay-vishnoi commented Mar 20, 2014

@carlosantoniodasilva : Code updated Please check.
When are we expecting next stable release, so that I can make another PR removing the same from the codebase?

carlosantoniodasilva added a commit that referenced this pull request Mar 20, 2014

Merge pull request #14271 from akshay-vishnoi/fixes
Deprecate superclass_delegating_accessor, use class_attribute instead.

@carlosantoniodasilva carlosantoniodasilva merged commit a2a7f8b into rails:master Mar 20, 2014

1 check was pending

default The Travis CI build is in progress
Details
@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva
Member

carlosantoniodasilva commented Mar 20, 2014

Thanks.

@carlosantoniodasilva

This comment has been minimized.

Show comment
Hide comment
@carlosantoniodasilva

carlosantoniodasilva Mar 20, 2014

Member

@akshay-vishnoi this is only going to be released on 4.2, which is going to take a while (considering 4.1 is in rc state), so keep it in your todo list :)

Member

carlosantoniodasilva commented Mar 20, 2014

@akshay-vishnoi this is only going to be released on 4.2, which is going to take a while (considering 4.1 is in rc state), so keep it in your todo list :)

@akshay-vishnoi

This comment has been minimized.

Show comment
Hide comment
@akshay-vishnoi

akshay-vishnoi Mar 20, 2014

Contributor

Ohkay Thanks 💚

Contributor

akshay-vishnoi commented Mar 20, 2014

Ohkay Thanks 💚

akshay-vishnoi pushed a commit to akshay-vishnoi/rails that referenced this pull request May 4, 2014

akshay-vishnoi pushed a commit to akshay-vishnoi/rails that referenced this pull request Sep 17, 2014

akshay-vishnoi pushed a commit to akshay-vishnoi/rails that referenced this pull request Sep 17, 2014

amccloud added a commit to amccloud/active_merchant that referenced this pull request Sep 28, 2014

Switch to Class#class_attribute
Class#superclass_delegating_accessor was deprecated in Rails 4.2.0

rails/rails#14271

lulalala added a commit to lulalala/active_merchant that referenced this pull request Oct 10, 2014

larrylv added a commit to larrylv/active_merchant that referenced this pull request Apr 21, 2015

Don't require active_support's delegating_attributes
Class#superclass_delegating_accessor from Rails is now deprecated.

rails/rails#14271

And uses of `superclass_delegating_accessor` use has been removed in #ffca0ca615bfa7bc99f8faae9b4ae95514a6604d and #ae02c93aaa52e4a63326d4b399bd8a9dd3977ed5

larrylv added a commit to larrylv/active_merchant that referenced this pull request Apr 21, 2015

Don't require active_support's delegating_attributes
Class#superclass_delegating_accessor from Rails is now deprecated.

rails/rails#14271

And uses of `superclass_delegating_accessor` use has been removed in #ffca0ca615bfa7bc99f8faae9b4ae95514a6604d and #ae02c93aaa52e4a63326d4b399bd8a9dd3977ed5

larrylv added a commit to larrylv/active_merchant that referenced this pull request Apr 30, 2015

Don't require active_support's delegating_attributes
Class#superclass_delegating_accessor from Rails is now deprecated.

rails/rails#14271

And uses of `superclass_delegating_accessor` use has been removed in #ffca0ca615bfa7bc99f8faae9b4ae95514a6604d and #ae02c93aaa52e4a63326d4b399bd8a9dd3977ed5

akshay-vishnoi pushed a commit to akshay-vishnoi/rails that referenced this pull request May 24, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment