railsadminteam / rails_admin

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data
MIT License
7.88k stars 2.25k forks source link

Reloading Routes before all cause Devise initializers not to be loaded dependent to the order of gem requires #3533

Closed jklimke closed 2 years ago

jklimke commented 2 years ago

Hi,

i noticed that reloading routes after causes to draw devise routes before all devise initializers have been executed. It possibly depends on the order of the gems within the gemfile. When devise gems are required before rails admin gems, everything runs smooth, if they are after rails_admin the devise initializers are not yet executed and though the devise routes cannot be drawn (e.g. not executing this initializer causes route drawing to fail https://github.com/heartcombo/devise/blob/6d32d2447cc0f3739d9732246b5a5bde98d9e032/lib/devise/rails.rb#L36)

This is the line that causes the route reload. Maybe this could be moved into a callback after finishing reload. The quick fix for me was to include devise before rails admin that causes devise initializers to run prior to rails_admin. maybe as the simplest "fix" this could be emphazized in the docs.

https://github.com/railsadminteam/rails_admin/blob/a2e366e8839c9046b9f9fde219875a05bc1a66bb/lib/rails_admin/engine.rb#L42

mshibuya commented 2 years ago

Closed by #3541.