Allow post tags to be removed

This commit is contained in:
2023-02-18 16:51:32 +11:00
parent 0c5384e79e
commit d1af1cac6a

View File

@@ -45,6 +45,12 @@ module Adamantium
end
end
def remove_tag(post_id:, tag:)
tag = posts.tags.where(label: tag).one
posts.post_tags.where(post_id: post_id, tag_id: tag[:id]).changeset(:delete).commit if tag
end
def post_listing(limit: nil)
posts
.where(post_type: "post")