Module: Reform::Form::Lotus

Defined in:
lib/reform/form/lotus.rb

Overview

Implements ::validates and friends, and #valid?.

Defined Under Namespace

Modules: ClassMethods Classes: Errors

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



24
25
26
27
# File 'lib/reform/form/lotus.rb', line 24

def self.included(base)
  # base.send(:include, Lotus::Validations)
  base.extend(ClassMethods)
end

Instance Method Details

#build_errorsObject



52
53
54
# File 'lib/reform/form/lotus.rb', line 52

def build_errors
  Errors.new
end

#valid?Boolean



46
47
48
49
50
# File 'lib/reform/form/lotus.rb', line 46

def valid?
  # DISCUSS: by using @fields here, we avoid setters being called. win!
  validator = Lotus::Validations::Validator.new(self.class.validations, @fields, errors)
  validator.validate
end