Files
baclight/app/models/id_card/field_exception.rb
T
2026-03-20 10:46:53 -04:00

36 lines
1.1 KiB
Ruby

module IdCard
class FieldException < ApplicationRecord
belongs_to :setup
has_many :field_exception_items, dependent: :destroy
accepts_nested_attributes_for :field_exception_items, allow_destroy: true, reject_if: :all_blank
VALID_TYPES = ['zipcode', 'state', 'family_id']
validates :exception_type, inclusion: { in: VALID_TYPES,
message: "%{value} is not a valid exception type" }
class << self
def permitted_params(params)
params.require(:id_card_setup).permit(
field_exceptions_attributes: [
:exception_type,
:exception_value,
:_destroy,
field_exception_items_attributes: [
:field_name,
:field_value,
:network_logo_id,
:provider_section_id,
:_destroy
]
]
)
end
end
end
end