Method: FormObj::ModelMapper::ModelAttribute#validate_primary_key!

Defined in:
lib/form_obj/model_mapper/model_attribute.rb

#validate_primary_key!Object



80
81
82
83
84
85
86
# File 'lib/form_obj/model_mapper/model_attribute.rb', line 80

def validate_primary_key!
  if @items.size > 1
    raise PrimaryKeyMappingError.new('Primary key should not be mapped to nested model')
  elsif @items.size == 0
    raise PrimaryKeyMappingError.new('Primary key should not be mapped to non-mapped attribute')
  end
end