From 887f0b71f71a0cd543dc59f877cd4a7da111fe52 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Sun, 19 Nov 2023 18:06:13 +1100 Subject: [PATCH] Fix auto_taging --- slices/micropub/repos/post_repo.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/slices/micropub/repos/post_repo.rb b/slices/micropub/repos/post_repo.rb index 6abb340..e273b3c 100644 --- a/slices/micropub/repos/post_repo.rb +++ b/slices/micropub/repos/post_repo.rb @@ -33,6 +33,20 @@ module Micropub end end + def by_title(title_contains:) + posts + .where(post_type: "post") + .published + .where(Sequel.ilike(:name, "%#{title_contains}%")).to_a + end + + def by_content(body_contains:) + posts + .where(post_type: "post") + .published + .where(Sequel.ilike(:content, "%#{body_contains}%")).to_a + end + def slug_exists?(slug) !!posts .where(slug: slug)