Module: ActiveData::Model::Validations::HelperMethods

Defined in:
lib/active_data/model/validations/nested.rb,
lib/active_data/model/validations/associated.rb

Instance Method Summary collapse

Instance Method Details

#validates_associated(*attr_names) ⇒ Object



14
15
16
# File 'lib/active_data/model/validations/associated.rb', line 14

def validates_associated(*attr_names)
  validates_with AssociatedValidator, _merge_attributes(attr_names)
end

#validates_nested(*attr_names) ⇒ Object



42
43
44
# File 'lib/active_data/model/validations/nested.rb', line 42

def validates_nested(*attr_names)
  validates_with NestedValidator, _merge_attributes(attr_names)
end

#validates_nested?(attr) ⇒ Boolean

Returns:



46
47
48
49
# File 'lib/active_data/model/validations/nested.rb', line 46

def validates_nested?(attr)
  _validators[attr.to_sym]
    .grep(ActiveData::Model::Validations::NestedValidator).present?
end