Class: Reform::Contract
- Inherits:
-
Disposable::Twin
- Object
- Disposable::Twin
- Reform::Contract
- Extended by:
- ValidatesWarning, Schema
- Defined in:
- lib/reform/contract.rb
Overview
Define your form structure and its validations. Instantiate it with a model, and then validate
this object graph.
Direct Known Subclasses
Defined Under Namespace
Modules: Readonly, Validate, ValidatesWarning Classes: Errors
Class Method Summary collapse
Methods included from ValidatesWarning
Methods included from Schema
Methods included from Readonly
Methods included from Validate
#errors, #validate, #validate!
Class Method Details
.properties(*args) ⇒ Object
FIXME: test me.
38 39 40 41 |
# File 'lib/reform/contract.rb', line 38 def self.properties(*args) = args. args.each { |name| property(name, .dup) } end |
.property(name, options = {}, &block) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/reform/contract.rb', line 23 def self.property(name, ={}, &block) if twin = .delete(:form) [:twin] = twin end [:pass_options] = true if = [:validates] validates name, .dup # .dup for RAils 3.x. end super end |