Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save rondevera/250552 to your computer and use it in GitHub Desktop.

Select an option

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
# 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