module ActiveModel::Datastore::NestedAttr::ClassMethods

Methods defined here will be class methods whenever we 'include DatastoreUtils'.

Public Instance Methods

validates_associated(*attr_names) click to toggle source

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.

# File lib/active_model/datastore/nested_attr.rb, line 242
def validates_associated(*attr_names)
  validates_with AssociatedValidator, _merge_attributes(attr_names)
end