require_dependency "renalware/medications"

module Renalware
  module Medications
    class PrescriptionTermination < ApplicationRecord
      include Accountable

      belongs_to :prescription

      validates :terminated_on,
        timeliness: { type: :date, after: ->(record) { record.prescription.prescribed_on } }
    end
  end
end

require_dependency "renalware/medications"

module Renalware
  module Medications
    class PrescriptionTermination < ApplicationRecord
      include Accountable

      belongs_to :prescription

      validates :terminated_on,
                timeliness: {
                  type: :date,
                  on_or_after: ->(record) { record.prescription.prescribed_on }
                }
    end
  end
end

Allow prescription termination on the same day as creation
Allow prescription termination on the same day as creation

Fixes bug #1146
