avo-hq/avo

Polymorphic Record is not preselected in Edit view, when using STI and using Avo Advanced gem

Closed this issue · 1 comments

Describe the bug

With Avo Advanced, the Polymorphic field does not prepopulate with the selected record when editing.

Steps to Reproduce

Steps to reproduce the behavior:

Reproduction respository is here: https://github.com/rctneil/avorepro

Must have Avo Advanced to replicate.

  1. Start app
  2. Navigate to Attractions
  3. Click "Daemonen"
  4. Edit "Daemonen"
  5. Change "Type" to "Coaster"
  6. Save "Daemonen"
  7. Click the first "Companyable" (id 6)
  8. Note the "Companyable" field shows as "Daemonen"
  9. Edit the "Companyable"
  10. Note the "Attraction" field is not set. (ie: not prepopulated)

Expected behavior & Actual behavior

When viewing the Edit page of a Companyable, the Attraction field should be populated with the selected Attraction.

Models and resource files

System configuration

Avo version: 3.13.6

Rails version: 7.2.1.1

Ruby version:

License type:

  • Community
  • Pro
  • Advanced

Are you using Avo monkey patches, overriding views or view components?

  • Yes. If so, please post code samples.
  • No

Screenshots or screen recordings

Additional context

This occurs ONLY when Avo Advanced is being used. DOES NOT happen when the "Type" of the "Attraction" record is blank or default. Only when set to "Coaster"

Impact

  • High impact (It makes my app un-usable.)
  • Medium impact (I'm annoyed, but I'll live.)
  • Low impact (It's really a tiny thing that I could live with.)

Urgency

  • High urgency (I can't continue development without it.)
  • Medium urgency (I found a workaround, but I'd love to have it fixed.)
  • Low urgency (It can wait. I just wanted you to know about it.)

There seems to be an issue with the searchable: true option on a polymorphic belongs_to field.

Thank you for the reproduction repository and the detailed steps.

If possible don't use searchable: true on the polymorphic belongs_to field until we look deeper into this and fix it.