Module: Reorm::Validations
- Included in:
- Model
- Defined in:
- lib/reorm/modules/validation_modules.rb
Instance Method Summary collapse
- #validate_exclusion_of(field, *values) ⇒ Object
- #validate_inclusion_of(field, *values) ⇒ Object
- #validate_length_of(field, options = {}) ⇒ Object
- #validate_presence_of(field) ⇒ Object
Instance Method Details
#validate_exclusion_of(field, *values) ⇒ Object
25 26 27 |
# File 'lib/reorm/modules/validation_modules.rb', line 25 def validate_exclusion_of(field, *values) ExclusionValidator.new(values, *field).validate(self) end |
#validate_inclusion_of(field, *values) ⇒ Object
21 22 23 |
# File 'lib/reorm/modules/validation_modules.rb', line 21 def validate_inclusion_of(field, *values) InclusionValidator.new(values, *field).validate(self) end |
#validate_length_of(field, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/reorm/modules/validation_modules.rb', line 11 def validate_length_of(field, ={}) if .include?(:minimum) MinimumLengthValidator.new([:minimum], *field).validate(self) end if .include?(:maximum) MaximumLengthValidator.new([:maximum], *field).validate(self) end end |
#validate_presence_of(field) ⇒ Object
7 8 9 |
# File 'lib/reorm/modules/validation_modules.rb', line 7 def validate_presence_of(field) PresenceValidator.new(*field).validate(self) end |