Module: ActiveModel::Datastore::NestedAttr::ClassMethods
- Defined in:
- lib/active_model/datastore/nested_attr.rb
Overview
Methods defined here will be class methods whenever we ‘include DatastoreUtils’.
Instance Method Summary collapse
-
#validates_associated(*attr_names) ⇒ Object
Validates whether the associated object or objects are all valid, typically used with nested attributes such as multi-model forms.
Instance Method Details
#validates_associated(*attr_names) ⇒ Object
Validates whether the associated object or objects are all valid, typically used with nested attributes such as multi-model forms.
NOTE: This validation will not fail if the association hasn’t been assigned. If you want to ensure that the association is both present and guaranteed to be valid, you also need to use validates_presence_of.
242 243 244 |
# File 'lib/active_model/datastore/nested_attr.rb', line 242 def validates_associated(*attr_names) validates_with AssociatedValidator, _merge_attributes(attr_names) end |