0

我有一个现有站点,其中包含 post.title 和 post.body 中的字段。安装 Globalize3 后,post.title 返回空白。有没有不需要将现有信息迁移到 post_translations 的方法?

4

2 回答 2

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

于 2011-05-18T18:38:31.697 回答
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

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

于 2011-03-16T12:31:12.253 回答