Class: ActiveSchema::Validations::ByNullability
- Inherits:
-
ByColumn
- Object
- ValueGenerator
- ByColumn
- ActiveSchema::Validations::ByNullability
- Defined in:
- lib/active_schema/validations/by_column.rb
Instance Method Summary collapse
Methods inherited from ByColumn
Methods inherited from ValueGenerator
Constructor Details
This class inherits a constructor from ActiveSchema::Validations::ByColumn
Instance Method Details
#generate ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/active_schema/validations/by_column.rb', line 30 def generate if not @column.null if @column.type == :boolean validation :validates_inclusion_of, :in => [true, false] else validation :validates_presence_of end end end |