Created
October 29, 2012 06:18
-
-
Save joshuaballoch/3971899 to your computer and use it in GitHub Desktop.
migrate data with globalize3
This file contains 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
#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