Method: FlexScaffold::Validations#add
- Defined in:
- lib/validations.rb
#add(attr_name, type, configuration = {}) ⇒ Object
Adds a validation of an attribute (attr_name) to the record and returns the individual set that was added
14 15 16 17 18 |
# File 'lib/validations.rb', line 14 def add(attr_name, type, configuration={}) attribute = add_type_to_hash(attr_name, type) VALIDATIONS_INFO.each do |rule| attribute.update(rule.to_s => configuration[rule.to_sym]) unless configuration[rule.to_sym].nil? end @attrs end |