<trix-editor> not being triggered after upgrading from Rails 6 to Rails 7

Author: aggy-kCreated Feb 20, 2025Updated Feb 20, 2025

Describe the bug I've recently upgraded a Rails 6 app to Rails 7, and with it from rails_admin 2.x.x to 3.3.0. Trix Editor on rails admin form does not load properly, I can see there's <trix-editor> HTML tag when inspected, but the editor failed to load (see screenshot 1)

Image

I also use action_text outside of rails_admin in this project, and the editors load just fine outside of rails_admin.

I noticed, while on any rails admin page, the console throws this error saying that identifier "extend" has already been declared.

Image

When inspecting the js file, here are the 2 "extend" identifiers:

ImageImage

Reproduction steps Upgrading from Ruby 2.7.2 Rails 6.1 to Ruby 3.1.2 and Rails 7.1 Upgrading from rails_admin 2 to rails_admin 3.3.0 Added gem sprocket-rails that was default in Rails 6

Expected behavior Rails admin will pick-up action_text and trix setup without any additional steps or configurations, and trix-editor will fire accordingly in a form where a model has rich_text field. Additional context

  • rails version: 7.1
  • rails_admin version: 3.3.0
  • rails_admin npm package version: -
  • full stack trace (if there's an exception)

Installing rails admin on a fresh rails 7 app works perfectly, so wondering if there's something missing that needs to be done when upgrading from Rails 6 to 7. Any kind of help/pointers would be greatly appreciated

Source: railsadminteam/rails_admin