2023-02-28 15:06:39 +01:00
|
|
|
# == Schema Information
|
|
|
|
#
|
2023-04-03 17:05:54 +02:00
|
|
|
# Table name: dossier_corrections
|
2023-02-28 15:06:39 +01:00
|
|
|
#
|
|
|
|
# id :bigint not null, primary key
|
2023-06-14 13:13:30 +02:00
|
|
|
# kind :string default("correction"), not null
|
2023-02-28 15:06:39 +01:00
|
|
|
# resolved_at :datetime
|
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
|
|
|
# commentaire_id :bigint
|
|
|
|
# dossier_id :bigint not null
|
|
|
|
#
|
2023-04-03 17:05:54 +02:00
|
|
|
class DossierCorrection < ApplicationRecord
|
2023-02-28 15:06:39 +01:00
|
|
|
belongs_to :dossier
|
|
|
|
belongs_to :commentaire
|
2023-02-28 15:11:48 +01:00
|
|
|
|
2023-06-02 12:43:08 +02:00
|
|
|
validates_associated :commentaire
|
|
|
|
|
2023-02-28 15:11:48 +01:00
|
|
|
scope :pending, -> { where(resolved_at: nil) }
|
2023-06-02 15:46:23 +02:00
|
|
|
|
2023-06-14 13:13:30 +02:00
|
|
|
enum kind: { correction: 'correction', incomplete: 'incomplete' }
|
|
|
|
|
2023-06-02 15:46:23 +02:00
|
|
|
def resolved?
|
|
|
|
resolved_at.present?
|
|
|
|
end
|
2023-02-28 15:06:39 +01:00
|
|
|
end
|