railsadminteam / rails_admin

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

Rails admin edit and create pages not properly initializing related records when eager load is false #3557

Closed rpalackas closed 2 years ago

rpalackas commented 2 years ago

Describe the bug I have a rails 6 application using mongodb. Currently if you edit any of our records that have relationships (seems to be all of them, has many, belongs to, embedds, etc) we get a text field with the object id instead of a proper edit/creation interface. This only happens when the server is in dev mode it works fine in production mode. Investigation points to needing to set config.eager_load to true in order for rails admin to properly initialize these fields

Reproduction steps Navigate rails admin create or edit for an object that relates to other objects in the database. Observe the fields. As an example User has many provider authorized sites and belongs to a provider authorized site. This is what is rendered on user edit for those to relationships:

Screen Shot 2022-10-18 at 1 55 08 PM

Expected behavior In comparison if you set the configuration field eager_load to true the relationship loads correctly for editing:

Screen Shot 2022-10-18 at 1 58 19 PM

we would like this functionality to work correctly without needing to set eager_load to true for development work. Is this a known issue or is something else going wrong?

Additional context

rpalackas commented 2 years ago

abandoning issue as I messed up the description too badly