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:
@@ -5,7 +5,8 @@ module ActsAsTaggableOn
|
|||||||
|
|
||||||
scope :public_for_api, -> do
|
scope :public_for_api, -> do
|
||||||
where(
|
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]
|
taggable: [Debate.public_for_api, Proposal.public_for_api]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user