I have an existing site with fields in post.title and post.body. After I installed Globalize3, post.title returns blank. Is there a way that I don't need to migrate the existing information to post_translations?
Asked
Active
Viewed 510 times
2 Answers
0
You can migrate this data by defining it to migrate the data when creating the translations table in the first place.
eg.
class TranslatePosts < ActiveRecord::Migration
def self.up
Post.create_translation_table!({
:title => :string,
:text => :text
}, {
:migrate_data => true
})
end
def self.down
Post.drop_translation_table! :migrate_data => true
end
end
You will have to drop the existing posts translations table beforehand.

Alastair Brunton
- 171
- 3
-
I did this did several times, but the English title and text don't copy over to post_translations. I'm not sure that they should. The gem seems to be installed correctly, since records can be added to post_translations. Is the :en local title and body supposed to be in the post table or the post_translations table. I would like the :en title and body to remains in the posts table and only foreign non-english languages to be in post_translations. Is there an option for this in Globalize3. Thanks for your help. – Joseph Magen Mar 18 '11 at 11:46
0
Hey I was having same issue. Found that for :migrate_data => true to work you need to have your globalize3 version 0.1.0.beta otherwise it won't work.
You can checkout this - https://github.com/svenfuchs/globalize3/issues/45

rtdp
- 2,067
- 1
- 17
- 32