Skip to content

Conversation

@heyvaleria
Copy link
Contributor

@heyvaleria heyvaleria commented Mar 6, 2025

Addresses #1994

In polymorphic associations we were not displaying the translations even when present.
By replacing to_s with model_name.human we preserve the reference to the activerecord objects, and we are able to show the translated values.

Screenshots

model_name-human
en-yml

If I remove translations for recipe, we get the model name Recipe where above you can see Ricetta
no-translation

I'm gonna see if I can add a spec.

Thanks @pablobm for the recommendation on the method to apply.

@pablobm
Copy link
Collaborator

pablobm commented Mar 7, 2025

Grazie! Do you think you can add that spec then?

@heyvaleria
Copy link
Contributor Author

Hi @pablobm
I was on PTO and am just back.
I have not forgotten about this. 😄
I'll send an update ASAP.

@heyvaleria
Copy link
Contributor Author

I'll look at the failures in the morning

@heyvaleria heyvaleria force-pushed the allow_translation_polymorophic_dropdown_models branch from e4718e6 to bc3c1ea Compare March 18, 2025 07:31
In polymorphic associations we were not displaying the translations even
when present. By replacing to_s with model_name.human we preserve the
reference to the activerecord objects, and we are able to show the
translated values.

Addresses #1994.
@nickcharlton nickcharlton force-pushed the allow_translation_polymorophic_dropdown_models branch from bc3c1ea to beecee1 Compare March 18, 2025 10:41
@nickcharlton
Copy link
Member

Thanks!

@nickcharlton nickcharlton merged commit ac4d7a3 into main Mar 18, 2025
27 checks passed
@nickcharlton nickcharlton deleted the allow_translation_polymorophic_dropdown_models branch March 18, 2025 10:44
@pablobm pablobm mentioned this pull request Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants