acts_as_follower icon indicating copy to clipboard operation
acts_as_follower copied to clipboard

remove deprecated custom_parent code

Open brchristian opened this issue 8 years ago • 9 comments

This removes the custom parent class code recently deprecated in #56.

I figure we don’t need to merge this right away, because #56 was just merged to master, but I wanted to make the PR while it was all still fresh in my mind. Nothing urgent, but we can merge whenever the timing makes sense.

Tests remain green, and this should not affect behavior (other than removing custom parent classes).

brchristian avatar Jan 31 '17 21:01 brchristian

Hey, I was trying to upgrade my app to Rails 5 and found this deprecation warning everywhere. It seems that is not caused by anything in my code since the method is being called internally. Can we merge it?

Nothing urgent, but we can merge whenever the timing makes sense.

I'd say it is urgent since master is the only version that support Rails 5 and this deprecation is being show to the users and there is nothing they can do to fix the deprecation.

rafaelfranca avatar Mar 23 '17 20:03 rafaelfranca

@rafaelfranca I certainly won’t argue with getting this merged. :) In the meantime, are you setting custom_parent_classes anywhere in your code? That was being used by many people as a workaround for the STI and ActiveRecord::Base issues which were addressed by #56. If so, I suspect (without knowing for sure) that you can now remove any custom_parent_classes and you’d see those deprecation warnings disappear.

brchristian avatar Mar 23 '17 21:03 brchristian

No, we don't have any calls for custom_parent_classes and parent_classes in our codebase. The only call is inside the gem lib/acts_as_follower/follower_lib.rb:10 and it is being called in https://github.com/tcocca/acts_as_follower/blob/c395dd2f1d62a5879e9d084c770dc35e02ee1043/lib/acts_as_follower/follower.rb#L32. So seems the gem is showing deprecation messages for the codebase that the gem itself is calling.

rafaelfranca avatar Mar 24 '17 17:03 rafaelfranca

The chain that I’m seeing looks like https://github.com/tcocca/acts_as_follower/blob/master/lib/acts_as_follower/follower.rb#L32 calls parent_class_name, as you note. That method is at https://github.com/tcocca/acts_as_follower/blob/72dfdffbddb13a15fb2462a72acb6093c9420400/lib/acts_as_follower/follower_lib.rb#L9-L14, which then calls parent_classes, which is at https://github.com/tcocca/acts_as_follower/blob/72dfdffbddb13a15fb2462a72acb6093c9420400/lib/acts_as_follower/follower_lib.rb#L35-L40. The guard clause before the deprecation warning triggers unless ActsAsFollower.custom_parent_classes, and . . . ah, it looks like the issue is that this variable is initialized to [] instead of nil.

Okay, so the cleanest way here is simply by merging this PR. The second cleanest way is by changing the guard clause to say unless ActsAsFollower.custom_parent_classes.present? instead of just unless ActsAsFollower.custom_parent_classes.

brchristian avatar Mar 24 '17 17:03 brchristian

Is this going to be merged?

sambostock avatar Jul 18 '17 00:07 sambostock

Please merge, my tests are ugly :)

JerryArns avatar Aug 16 '17 04:08 JerryArns

Yes can we merge?

kidbombay avatar Jan 26 '18 14:01 kidbombay

Does anyone have contact with Tom?

JerryArns avatar Jan 26 '18 19:01 JerryArns

Hey guys, It's steel not working, and my logs render :

DEPRECATION WARNING: Setting custom parent classes is deprecated and will be removed in future versions. (called from parent_class_name at /Users/me/.rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/bundler/gems/acts_as_follower-c5ac7b9601c4/lib/acts_as_follower/follower_lib.rb:10)

Gregdebrick avatar May 19 '18 22:05 Gregdebrick