Leadformance/hstore_translate

Is there a way to do assignment with culture

Opened this issue · 1 comments

I'm maintaining an app that uses this gem. I'd like to seed some data but I don't want to iterate through cultures to do it.

I found I could do this:

model.send('write_hstore_translation', 'name', translation.text, culture)

But that is a protected method. Is there another assignment function call that I can make were I can pass in the culture?

Thanks,
John

Yes. You assign the culture to the end of the field name. For instance, if you are translating title the Frech version would be title_fr.

Model.title = 'Default language title'
Model.title_fr = 'French language title'