Simple Translated Storage of ActiveRecord Columns

There are several solutions for storing translations, but most of them involve additional migrations for each  translated column. A more as-you-go solution offers translated_attributes Rails Plugin

  • stores all translations into one ‘translations’ table
  • AR-like interface (validations/update_attributes etc works)
  • performance (only one request to translations table for any amount of translated columns)
class User < ActiveRecord::Base
  translated_attributes :name, :about, :description
end = 'Myself' #stores name_in_#{I18n.locale} = "Ich"

Have a look and tell me your opinion!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s