feat(announces): anyone can read announces

This commit is contained in:
Colin Darie 2023-10-04 14:57:32 +02:00
parent ff8ed6016e
commit e4c37758d4
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
11 changed files with 189 additions and 0 deletions

View file

@ -11,4 +11,7 @@ class ReleaseNote < ApplicationRecord
validates :categories, presence: true, inclusion: { in: CATEGORIES }
validates :body, presence: true
scope :published, -> { where(published: true, released_on: ..Date.current) }
scope :for_categories, -> (categories) { where("categories && ARRAY[?]::varchar[]", categories) }
end