Nested in Forms
You can use "Show on edit screens" to make the field available in the edit view. However, this will render it using the show view component.
To enable nested creation for the field, allowing it to be created and / or edited alongside its parent record within the same form, use the nested option which is a hash with configurable option.
Keep in mind that this will display the field’s resource as it appears in the edit view.
-> nested
Enables this field as a nested form in the specified views.
Default value
{}
Possible values
A hash with the following options:
on:Views in which to enable nesting. Accepted values:limit:(Only forhas_manyandhas_and_belongs_to_manyfields) Hides the "Add" button when the specified limit is reached.
TIP
Setting nested: true is a shortcut for nested: { on: :forms }.
Example
ruby
# app/avo/resources/book.rb
class Avo::Resources::Book < Avo::BaseResource
def fields
# Shortcut for full nesting
field :authors, as: :, nested: true
# Explicit nesting on new only
field :authors, as: :, nested: { on: :new }
# Explicit nesting on edit only
field :authors, as: :, nested: { on: :edit }
# Explicit nesting on both new and edit
field :authors, as: :, nested: { on: :forms }
# Limit nested creation (for has_many or has_and_belongs_to_many only)
field :authors,
as: :,
nested: { on: [:new, :edit], limit: 2 }
end
end