2011-03-16 107 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中有這個選項嗎?謝謝你的幫助。 –