제발 말해 줄래 - create_translation_table 방법을 사용하는 방법! null => false, : default => "abc"???globalize2 - create_translation_table! 및 컬럼에 대한 옵션
def create_translation_table!(fields)
translated_attribute_names.each do |f|
raise MigrationMissingTranslatedField, "Missing translated field #{f}" unless fields[f]
end
fields.each do |name, type|
if translated_attribute_names.include?(name) && ![:string, :text].include?(type)
raise BadMigrationFieldType, "Bad field type for #{name}, should be :string or :text"
end
end
self.connection.create_table(translation_table_name) do |t|
t.references table_name.sub(/^#{table_name_prefix}/, "").singularize
t.string :locale
fields.each do |name, type|
t.column name, type
end
t.timestamps
end
self.connection.add_index(
translation_table_name,
"#{table_name.sub(/^#{table_name_prefix}/, "").singularize}_id",
:name => translation_index_name
)
end
당신이 볼 수 있듯이, t.column
선언에 전달에는 세 번째 매개 변수가없는 : 여기에
Post.create_translation_table! :title => :string, :text => :text, {:null=>false, :default=>"abc"}