Provides a way of storing and retreiving tranlsation keys and options in your ActiveRecord models.
Add gem 'translates_fields'
to your Gemfile
and run bundle install
.
Your model must have a text column defined.
class Address < ActiveRecord::Base
translates :country
end
You then assign a translation key for your instances.
address = Address.new(:country => :france)
puts address.country
# => This is the same as calling I18n.translate(:'models.address.attributes.country.france')
- ruby 1.9.2
- rails 3+