How we've migrated from globalize to hstore-translate
Описание и применение
Перенос приложения Rails из Globalize в hstore-translate улучшил производительность и упростил схему, объединив переводы в один столбец hstore.
Задача
The Rails application used Globalize for translations, but Globalize was slow and required a separate translations table, causing performance and maintenance issues.
Результат
The migration reduced database joins, improved read performance, and simplified the schema by consolidating translations into a single hstore column per model.
Рабочий процесс
- 1. Added hstore column to each model that required translations.
- 2. Migrated existing translation data from Globalize tables into the new hstore column using a rake task.
- 3. Updated model code to use hstore-translate methods instead of Globalize.
- 4. Removed Globalize gems and tables from the schema.
- 5. Tested application to ensure translations displayed correctly and performance improved.
Доказательства
We replaced Globalize with hstore-translate and saw a noticeable performance improvement.
- Дата записи: 2026-09-18T13:00:21.627Z