Pass associated_class to collection from show#2238
Conversation
this fixes an issue where the embedded collection is using the parent's class to define i18n headers
|
Thank you for the MR 🙂 I'm trying to reproduce the issue locally, but I'm not having any luck. Would you be able to explain it in terms of the example app? For instance, in the example app we have ---
en:
# ...
helpers:
label:
order:
address_state: "State code"When I visit a customer show page, I do see the translation: Perhaps I'm looking at the wrong thing? |
|
Oh yes. Sorry forgot to add that detail. Yes it's related to the active record fallback. it would be picked up by the orders dashboard, but not the embedded orders list in the customer show. |
|
Oh, I see! Thank you for explaining. The fact that Don't worry about testing. This is too tricky (I already spent a lot of time trying to test something similar elsewhere and I'm not sure that there's much return of investment to be had). Merging. |

This fixes an issue where the embedded collection is using the parent's class to define i18n headers.
Example: Ressource order has_many order_items.
Order dashboard declares
order_items: Field::HasManyWhen the show which includes the
order_itemsassociation is rendered within the collection partial it uses the parent's resource (Order) instead ofOrderItemto determine the header label default.Not sure how to add a test for this behavior.