DB restructure, print page
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
module IdCard
|
||||
class FieldException < ApplicationRecord
|
||||
belongs_to :configuration
|
||||
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_configuration).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
|
||||
Reference in New Issue
Block a user