Module: Granite::Form::Model::Validations::HelperMethods

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

Instance Method Summary collapse

Instance Method Details

#validates_associated(*attr_names) ⇒ Object



15
16
17
# File 'lib/granite/form/model/validations/associated.rb', line 15

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

#validates_nested(*attr_names) ⇒ Object



44
45
46
# File 'lib/granite/form/model/validations/nested.rb', line 44

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

#validates_nested?(attr) ⇒ Boolean

Returns:



48
49
50
51
# File 'lib/granite/form/model/validations/nested.rb', line 48

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