Class: Schematic::Generator::Restrictions::Length
- Inherits:
-
Base
- Object
- ColumnValidator
- Base
- Schematic::Generator::Restrictions::Length
- Defined in:
- lib/schematic/generator/restrictions/length.rb
Instance Attribute Summary
Attributes inherited from ColumnValidator
Instance Method Summary collapse
Methods inherited from ColumnValidator
#for_validator, #initialize, #validators_for_column
Constructor Details
This class inherits a constructor from Schematic::Generator::ColumnValidator
Instance Method Details
#generate(builder) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/schematic/generator/restrictions/length.rb', line 7 def generate(builder) for_validator ActiveModel::Validations::LengthValidator do |validator| builder.xs(:maxLength, 'value' => validator.[:maximum]) if validator.[:maximum] builder.xs(:minLength, 'value' => validator.[:minimum]) if validator.[:minimum] end end |