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
)
end
And 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
# ...
end
When 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):

When a
NestedHasManyfield in turn contains an associative field, such as aBelongsTo, the JS enhancements from Administrate do not apply correctly when adding new sub-records.This is an example model:
And the corresponding dashboard:
When creating or editing a recipe, if I click to "Add Recipe Ingredient", the new sub-form for
RecipeIngredientwill have a plain select dropdown. However pre-existing records ofRecipeIngredientwill be enhanced with Selectize (as provided by Administrate by default):