2019-08-24 12:06:48 +02:00
|
|
|
class PostStatus < ApplicationRecord
|
2022-07-18 10:47:54 +02:00
|
|
|
include TenantOwnable
|
2022-05-08 16:36:35 +02:00
|
|
|
include Orderable
|
2019-09-24 21:16:51 +02:00
|
|
|
|
2022-05-08 16:36:35 +02:00
|
|
|
has_many :posts, dependent: :nullify
|
2024-01-18 17:04:24 +01:00
|
|
|
has_many :post_status_changes, dependent: :destroy
|
2019-09-18 21:00:38 +02:00
|
|
|
|
2022-07-18 10:47:54 +02:00
|
|
|
validates :name, presence: true, uniqueness: { scope: :tenant_id }
|
2019-08-24 12:06:48 +02:00
|
|
|
validates :color, format: { with: /\A#(?:[0-9a-fA-F]{3}){1,2}\z/ }
|
2019-09-09 16:50:33 +02:00
|
|
|
|
|
|
|
|
class << self
|
|
|
|
|
def find_roadmap
|
|
|
|
|
where(show_in_roadmap: true)
|
|
|
|
|
.order(order: :asc)
|
|
|
|
|
end
|
|
|
|
|
end
|
2019-08-24 12:06:48 +02:00
|
|
|
end
|