Fix deprecation warning in Tagging monkey patch

We were getting a warning in Rails 6.0:

DEPRECATION WARNING: Class level methods will no longer inherit scoping
from `public_for_api` 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
`ActsAsTaggableOn::Tag.default_scoped`.
This commit is contained in:
Javi Martín
2021-09-19 02:09:16 +02:00
parent 2e863fdc51
commit dba68c2c04

View File

@@ -5,7 +5,8 @@ module ActsAsTaggableOn
scope :public_for_api, -> do
where(
tag: Tag.where(kind: [nil, "category"]),
# TODO: remove default_scoped after upgrading to Rails 6.1
tag: Tag.default_scoped.where(kind: [nil, "category"]),
taggable: [Debate.public_for_api, Proposal.public_for_api]
)
end