Class: IronAdmin::NestedAttributesValidator
- Inherits:
-
Object
- Object
- IronAdmin::NestedAttributesValidator
- Defined in:
- lib/iron_admin/nested_attributes_validator.rb
Overview
Guard object that validates a model declares accepts_nested_attributes_for for a given association before allowing nested form configuration.
Called during Resource.nested_associations resolution. Raises ArgumentError if the model is misconfigured.
Class Method Summary collapse
Class Method Details
.validate!(model_class, association_name) ⇒ void
This method returns an undefined value.
17 18 19 20 21 22 23 |
# File 'lib/iron_admin/nested_attributes_validator.rb', line 17 def self.validate!(model_class, association_name) return if model_class..key?(association_name.to_sym) raise ArgumentError, "#{model_class} must declare `accepts_nested_attributes_for :#{association_name}` " \ "to use nested forms in IronAdmin" end |