Has many field renders (potentially) wrong partial
Created by: keithlayne
If a dashboard has one or more has_many fields, then on that dashboard's show page the collection
partial will be rendered for each has_many field:
The problem has to do with the template lookup path. Take for example a class Alpha
that has many Bravo
s. On the Alpha
show page, the collection
partial will be rendered for each relation:
- If you have overridden the
collection
partial forBravo
, it will never be rendered for thebravos
field. - If you have overridden the
collection
partial forAlpha
, it will be used to render thebravos
collection.
Neither of these seem to be the intended behavior. It would be easy to create a test exposing this bug. I have successfully gotten my desired behavior by putting an ugly hack in app/views/fields/has_many/_show.html.erb
.
It seems likely that similar bugs exist in this project in other places - I can't confirm or deny that right now. It seems like to really fix this there needs to be support for resolving the correct administrate partial regardless of the view context while respecting template inheritance.