How we've migrated from globalize to hstore-translate
Description and use
Migrating from Globalize to hstore-translate simplifies the schema and improves performance in a Rails application.
Problem
Globalize was causing performance and maintenance issues in a Rails application that needed a more efficient way to store translations.
Outcome
The migration reduced the number of tables, simplified the schema, and improved query performance for translated attributes.
Workflow
- 1. Added the hstore-translate gem to the Gemfile and ran bundle install.
- 2. Created a migration to add an hstore column to the target tables.
- 3. Updated the model to use
hstore_translateinstead of Globalize’stranslatesmacro. - 4. Wrote a data migration script to copy existing translations from Globalize tables into the new hstore column.
- 5. Ran the migration and verified data integrity via unit tests.
- 6. Removed Globalize-related code and tables from the application.
Evidence
We decided to replace Globalize with hstore-translate because it was more lightweight and better suited to our needs.
The migration script copies data from the Globalize translation tables into the new hstore column.
- Record date: 2026-10-02T11:40:54.710Z