globalize3 gemのgithubページhttps://github.com/svenfuchs/globalize3には、複数の翻訳が必要な文字列属性とテキスト属性を使用してモデルの移行を準備する方法の概要が明確に示されています。例えば:
class CreatePosts < ActiveRecord::Migration
def up
create_table :posts do |t|
t.timestamps
end
Post.create_translation_table! :title => :string, :text => :text
end
def down
drop_table :posts
Post.drop_translation_table!
end
end
user_idやその他の整数値属性の保存など、変換を必要としない特定の属性がある場合はどうでしょうか。Post.create_translation_tableの一部として以下に記述しますか?宣言、または上記のcreate_table:posts部分に残しますか?
正しいEG:
def up
create_table :posts do |t|
#put it here as t.integer :user_id?
end
Post.create_translation_table! :title => string, :text => :text #user_id dec here?
end
ありがとう!