This repository has been archived by the owner. It is now read-only.
Lets you set and retrieve translation keys in your ActiveRecord models
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.rvmrc
Gemfile
Gemfile.lock
README.md
Rakefile
translates_fields.gemspec

README.md

translates_fields

Build status

Provides a way of storing and retreiving tranlsation keys and options in your ActiveRecord models.

Installation

Add gem 'translates_fields' to your Gemfile and run bundle install.

Use

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')

Compatibility

  • ruby 1.9.2
  • rails 3+