2011-03-16 64 views

回答

0

您可以在创建翻译表时首先将其定义为迁移数据。

例如。

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 

您必须事先删除现有的帖子翻译表。

+0

我做这个做了好几次,但英文标题和正文不超过复制到post_translations。我不确定他们应该如何。该宝石似乎安装正确,因为记录可以添加到post_translations。是:本地标题和正文应该在帖子表或post_translations表中。我希望:标题和正文留在帖子表中,只有外国非英语语言才能在post_translations中。 Globalize3中有这个选项吗?谢谢你的帮助。 –