Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How we've migrated from globalize to hstore-translate

Описание и применение

Перенос проекта с Globalize на hstore-translate упрощает схему и повышает производительность.

Задача

The Rails application relied on the Globalize gem for translations, which caused performance and maintenance issues.

Результат

The migration reduced the number of tables, simplified queries, and improved maintainability of the translation system.

Рабочий процесс

  • 1. Added the hstore-translate gem to the Gemfile and ran bundle install.
  • 2. Created a migration to add an hstore column (e.g., "translations") to each model that required translations.
  • 3. Updated the model to use hstore-translate instead of Globalize, specifying the translatable attributes.
  • 4. Wrote a data migration script to copy existing translations from Globalize tables into the new hstore column.
  • 5. Ran the data migration and verified data integrity.
  • 6. Removed Globalize-related tables and code, and updated tests to use the new translation mechanism.
  • 7. Deployed the changes to staging and monitored performance improvements.

Доказательства

We migrated from Globalize to hstore-translate to simplify our schema and improve performance.

  • Дата записи: 2026-10-10T03:41:29.953Z