Skip to content

Instantly share code, notes, and snippets.

@joshuaballoch
Created October 29, 2012 06:18
Show Gist options
  • Save joshuaballoch/3971899 to your computer and use it in GitHub Desktop.
Save joshuaballoch/3971899 to your computer and use it in GitHub Desktop.
migrate data with globalize3
#Suppose I have added the new translation columns and set in the CriterionMaterial to translate audit_result and auditor_name
#EG: in the migration:
add_column :criterion_material_translations, :audit_result, :text
add_column :criterion_material_translations, :auditor_name, :string
#now to migrate old columns to new columns...
CriterionMaterial.all.each do |k|
Globalize.with_locale :"en-US" do
k.audit_result = #what to put here?
end
end
#problems:
k.audit_result #this will not access the old column, it will access the new column in the criterion_material_translations table
#How to access the old column in order to migrate the data?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment