Module: Volt::Validations::ClassMethods
- Defined in:
- lib/volt/models/validations.rb
Instance Method Summary collapse
- #custom_validations ⇒ Object
- #validate(field_name = nil, options = nil, &block) ⇒ Object
-
#validations ⇒ Object
TODO: For some reason attr_reader on a class doesn’t work in Opal.
Instance Method Details
#custom_validations ⇒ Object
29 30 31 |
# File 'lib/volt/models/validations.rb', line 29 def custom_validations @custom_validations end |
#validate(field_name = nil, options = nil, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/volt/models/validations.rb', line 11 def validate(field_name=nil, =nil, &block) if block if field_name || raise "validate should be passed a field name and options or a block, not both." end @custom_validations ||= [] @custom_validations << block else @validations ||= {} @validations[field_name] = end end |
#validations ⇒ Object
TODO: For some reason attr_reader on a class doesn’t work in Opal
25 26 27 |
# File 'lib/volt/models/validations.rb', line 25 def validations @validations end |