2023-10-03 16:14:09 +02:00
|
|
|
class ReleaseNote < ApplicationRecord
|
2023-10-03 16:20:13 +02:00
|
|
|
has_rich_text :body
|
|
|
|
|
|
|
|
CATEGORIES = [
|
|
|
|
'administrateur',
|
|
|
|
'instructeur',
|
|
|
|
'expert',
|
|
|
|
'usager',
|
|
|
|
'api'
|
|
|
|
]
|
|
|
|
|
|
|
|
validates :categories, presence: true, inclusion: { in: CATEGORIES }
|
|
|
|
validates :body, presence: true
|
2023-10-04 14:57:32 +02:00
|
|
|
|
|
|
|
scope :published, -> { where(published: true, released_on: ..Date.current) }
|
|
|
|
scope :for_categories, -> (categories) { where("categories && ARRAY[?]::varchar[]", categories) }
|
2023-10-03 16:14:09 +02:00
|
|
|
end
|