collectiveidea / awesome_nested_set

An awesome replacement for acts_as_nested_set and better_nested_set.
MIT License
2.39k stars 492 forks source link

Deprecation warning in Rails 6.1 #422

Closed fatkhanfauzi closed 4 years ago

fatkhanfauzi commented 4 years ago

Hi,

i'm using ruby 2.6.5 and rails 6.1 I get this warning when calling descendants method.

DEPRECATION WARNING: Class level methods will no longer inherit scoping from `###` in Rails 6.1. To continue using the scoped relation, pass it into the block directly. To instead access the full set of models, as Rails 6.1 will, use `Model.unscoped`, or `Model.default_scoped` if a model has default scopes.

any idea ?

abotchkarev commented 4 years ago

Source of warning is module ClassMethods in model.rb https://github.com/collectiveidea/awesome_nested_set/blob/d820bc6858fc00b8223d9265f05afe46ffd07ed9/lib/awesome_nested_set/model.rb#L26 Specifically, several methods (such as :left_of, :right_of and more) have where ... which must be unscoped or default_scoped. I tried changing all to one or the other, but it did not work.

aualdrich commented 4 years ago

I'm getting this error, too, and traced it back to awesome_nested_set. Thanks for opening this issue!