|
4 | 4 | # |
5 | 5 | # By default, Strata::Determination provides: |
6 | 6 | # - A polymorphic +subject+ association to any aggregate root |
7 | | -# - Validations for all required fields (+decision_method+, +reason+, +outcome+, +determination_data+, +determined_at+) |
8 | | -# - Query scopes for filtering by subject, decision method, reason, outcome, user, and time windows |
| 7 | +# - Validations for all required fields (+decision_method+, +reasons+, +outcome+, +determination_data+, +determined_at+) |
| 8 | +# - Query scopes for filtering by subject, decision method, reasons, outcome, user, and time windows |
9 | 9 | # - Support for automated, staff-reviewed, and attested determinations |
10 | 10 | # |
11 | 11 | # Extend this class to add: |
|
19 | 19 | # enum decision_method: { automated: "automated", staff_review: "staff_review", attestation: "attestation" } |
20 | 20 | # enum outcome: { approved: "approved", denied: "denied", pending: "pending" } |
21 | 21 | # |
22 | | -# validates :reason, inclusion: { in: %w(pregnant_member incarcerated other) } |
| 22 | +# validates :reasons, presence: true, inclusion: { in: %w(pregnant_member incarcerated other) } |
23 | 23 | # end |
24 | 24 | # |
25 | 25 | # @example Query determinations for a specific subject |
|
31 | 31 | # @see Strata::Determinable for the +record_determination!+ method to use in models |
32 | 32 | # |
33 | 33 | class Determination < Strata::Determination |
| 34 | + VALID_REASONS = %w[ |
| 35 | + age_under_19_exempt |
| 36 | + age_over_65_exempt |
| 37 | + pregnancy_exempt |
| 38 | + american_indian_alaska_native_exempt |
| 39 | + ].freeze |
| 40 | + |
34 | 41 | enum :decision_method, { automated: "automated", manual: "manual" } |
35 | | - enum :reason, { |
36 | | - age_under_19_exempt: "age_under_19_exempt", |
37 | | - age_over_65_exempt: "age_over_65_exempt", |
38 | | - pregnancy_exempt: "pregnancy_exempt", |
39 | | - american_indian_alaska_native_exempt: "american_indian_alaska_native_exempt" |
40 | | - } |
41 | 42 | enum :outcome, { compliant: "compliant", exempt: "exempt" } |
| 43 | + |
| 44 | + validates :reasons, presence: true, inclusion: { in: VALID_REASONS } |
42 | 45 | end |
0 commit comments