The UI of nested field for has_many association won't work properly on Rails Admin 3.0.0.
After pushed "Add a new ..." button, you would find two strange points:
The width of instance tabs broadly extends, as wide as other input field.
The nested field won't be closed; it would show up just after toggled up.
These behaviors occur in these cases:
Create (new) view
Update (edit) view, if you push add button without opening the field beforehand
Not occur (works properly) in this case:
Update (edit) view, if you push add button after opening the field at first
Reproduction steps
It's easy to reproduce this behavior; Simply create two models connected with has_many/belongs_to association.
Here is my examples.
app/models/author.rb
class Author < ApplicationRecord
has_many :books, dependent: :destroy
accepts_nested_attributes_for :books
end
app/models/book.rb
class Book < ApplicationRecord
belongs_to :author
end
config/initializers/rails_admin.rb
RailsAdmin.config do |config|
config.asset_source = :webpacker
config.actions do
((snip))
end
config.included_models = ['Author', 'Book']
config.model 'Book' do
include_fields :title
end
end
Expected behavior
In the UI of nested field,
The width of instance tabs is fit to the length of strings inside, not fully expanded.
The nested field would be opened and then closed when toggle button is switched.
Additional context
rails version: 6.1.6
rails_admin version: 3.0.0, and also current master (652418c)
rails_admin npm package version: 3.0.0, and also current master (652418c)
Describe the bug
The UI of nested field for
has_many
association won't work properly on Rails Admin 3.0.0. After pushed "Add a new ..." button, you would find two strange points:These behaviors occur in these cases:
Not occur (works properly) in this case:
Reproduction steps
It's easy to reproduce this behavior; Simply create two models connected with
has_many/belongs_to
association. Here is my examples.app/models/author.rb
app/models/book.rb
config/initializers/rails_admin.rb
Expected behavior
In the UI of nested field,
Additional context
rails
version: 6.1.6rails_admin
version: 3.0.0, and also current master (652418c)rails_admin
npm package version: 3.0.0, and also current master (652418c)