Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
easy accessors for ActiveRecord fields translated with globalize3
Ruby
branch: master

This branch is 2 commits ahead of tomash:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
Gemfile
Gemfile.lock
MIT-LICENSE
README.textile
Rakefile
globalize3_accessors.gemspec
init.rb

README.textile

Globalize3 Accessors

Introduction

Generator of easy accessor methods for models using Globalize3.

Use globalize_accessors with list of translated fields you want easy access to and extra :locales array listing locales for which you want the accessors to be generated.

This way a single form can be used to edit given model fields with all anticipated translations.

Installation

Add this line to Gemfile:


gem "globalize3_accessors", :git => 'git://github.com/tomash/globalize3_accessors.git'

Example

Definition like this:


class Product
  translates :title, :description
  globalize_accessors :pl, :en, :de
end

Gives you methods: title_pl, title_en, title_de, title_pl=, title_en=, title_de= (and similar set of description_* methods). And they work seamlessly with Globalize3 (not even touching the “core” title, title= methods used by Globalize3 itself).

TODO

  • Make it work with full-blown locales including dash character (minus sign) like en-US, en-GB, pl-PL etc.

License

Copyright © 2011 Tomek “Tomash” Stachewicz (homepage), released under the MIT license.

Something went wrong with that request. Please try again.