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?
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.
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
精彩评论