-
Notifications
You must be signed in to change notification settings - Fork 106
Open
Description
When a NestedHasMany field in turn contains an associative field, such as a BelongsTo, the JS enhancements from Administrate do not apply correctly when adding new sub-records.
This is an example model:
class Recipe < ApplicationRecord
has_many :recipe_ingredients
has_many :ingredients, through: :recipe_ingredients
accepts_nested_attributes_for(
:recipe_ingredients,
reject_if: :all_blank,
allow_destroy: true
)
endAnd the corresponding dashboard:
require "administrate/base_dashboard"
class RecipeDashboard < Administrate::BaseDashboard
ATTRIBUTE_TYPES = {
id: Field::Number,
name: Field::String,
recipe_ingredients: Field::NestedHasMany.with_options(
skip: [:recipe]
),
}.freeze
# ...
endWhen creating or editing a recipe, if I click to "Add Recipe Ingredient", the new sub-form for RecipeIngredient will have a plain select dropdown. However pre-existing records of RecipeIngredient will be enhanced with Selectize (as provided by Administrate by default):
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
