Created
December 7, 2009 02:29
-
-
Save rondevera/250552 to your computer and use it in GitHub Desktop.
Using Globalize2 for Rails, copy existing attributes from ActiveRecord instances to their default translation proxy instances
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Using Globalize2: http://github.com/joshmh/globalize2 | |
| # Copy existing attributes from ActiveRecord instance to default translation | |
| # proxy instance: | |
| SomeClass.all.each do |x| | |
| x.globalize_options[:translated_attributes].each do |a| | |
| x.send(:"#{a}=", x.read_attribute(a)) | |
| end | |
| x.save | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment