In an API-only rails app using globalize - how do I return all the translations for a model?
ie.
[
{
"id": 1,
"name_ar": "كرستوفر نولان",
"name_en": "Christopher Nolan",
"name_fr": "Christopher Nolan"
},
{
"id": 2,
"name_ar": "ميشيل جوندري",
"name_en": "Michael Gondry",
"name_fr": "Michael Gondry"
},
// ...
]
I've been searching for quite some time about this but I have failed to find a solution.
You can do something like this: (not a complete efficient solution but just a try if that helps)
Please change the names according to your application and pass the attributes accordingly.