Module: Mongo::Model::Validation
- Defined in:
- lib/mongo/model/validation.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#errors ⇒ Object
2 3 4 |
# File 'lib/mongo/model/validation.rb', line 2 def errors @_errors ||= Validatable::Errors.new end |
#run_validations ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/mongo/model/validation.rb', line 6 def run_validations self.class.validations.each do |v| if v.respond_to?(:validate) v.validate self elsif v.is_a? Proc v.call self else send v end end true end |