No commit activity in last 3 years
No release in over 3 years
A gem that adds simple mechanism to deal with localization of Active Record models
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 3.0.0
>= 0
 Project Readme

ActsAsLocalized

Gem Version Gem Downloads Build Status

ActsAsLocalized extends ActiveRecord to add localization mechanism for model attributes.

Example

create_table :pictures do |t|
  t.string :title_en
  t.string :title_fr
  t.text :description_en
  t.text :description_fr
end

class Picture < ActiveRecord::Base
  acts_as_localized :title, :description
end

picture = Picture.create!(
  :title_en       => 'Title EN',
  :title_fr       => 'Title FR',
  :description_en => 'Description EN',
  :description_fr => 'Description FR',
)

I18n.locale = :en
picture.title #=> Title EN
picture.title = 'Updated Title EN' # same as `picture.title_en=`

I18n.locale = :fr
picture.title # => Title FR
picture.title = 'Updated Title FR' # same as `picture.title_fr=`

Copyright 2015 Oleg Khabarov