Class: Schematic::Generator::Restrictions::Numericality

Inherits:
Base show all
Defined in:
lib/schematic/generator/restrictions/numericality.rb

Instance Attribute Summary

Attributes inherited from ColumnValidator

#column, #klass

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
# File 'lib/schematic/generator/restrictions/numericality.rb', line 7

def generate(builder)
  for_validator ActiveModel::Validations::NumericalityValidator do |validator|
    builder.xs(:pattern, 'value' => '\d+')
  end
end