Validation
Last updated
Last updated
include ForestAdmin::Types
@create_agent.customize_collection('customer') do |collection|
collection.add_field_validation('firstName', Operators::PRESENT)
.add_field_validation('firstName', Operators::LONGER_THAN, 2)
.add_field_validation('firstName', Operators::SHORTER_THAN, 13)
.add_field_validation('firstName', Operators::MATCH, /^[a-z]+$/)
end@create_agent.collection :customer do |collection|
collection.validates :firstName,
present: true,
longer_than: 2,
shorter_than: 13,
match: /^[a-z]+$/
end