Filter week posts on homepage

This commit is contained in:
2023-08-07 15:47:12 +10:00
parent e21b3fa2c3
commit b28bdb0427
4 changed files with 51 additions and 1 deletions

View File

@@ -22,6 +22,16 @@ module Adamantium
where(self[:published_at] <= Time.now)
end
def weekly
ref = post_tags.where(:tag_id => "70").select(:post_id).dataset
where(:id => ref)
end
def non_weekly
ref = post_tags.where(:tag_id => "70").select(:post_id).dataset
exclude(:id => ref)
end
def published_between(start_date, end_date)
where(self[:published_at] >= start_date)
.where(self[:published_at] <= end_date)