在globalize/globalize中,我想回退到其他列。样品来源。
class CreatePosts < ActiveRecord::Migration
def up
create_table :posts do |t|
t.string :foo, null: false
t.timestamps null: false
end
Post.create_translation_table! hoge: :string
end
end
class Post < ActiveRecord::Base
# this not work. but I want to like this.
translates :hoge, :fallbacks_for_empty_translations => :foo
end
虽然看起来像是对 columnhoge
和的双重管理foo
,但我计划在 column为空hoge
的情况下显示 column 的内容。foo
您可以编辑开源的内容globalize
。