内容简介:如何使用Rails迁移执行此操作?我没有看到任何关于alter_translation_table的文档!方法或类似的东西……翻译自:https://stackoverflow.com/questions/7742177/rails-globalize3-gem-how-do-i-add-an-additional-field-to-the-translation-table
如何使用Rails迁移执行此操作?我没有看到任何关于alter_translation_table的文档!方法或类似的东西……
使用Globalize4,只需:
class AddHintToCategory < ActiveRecord::Migration def up Category.add_translation_fields! hint: :text end def down remove_column :category_translations, :hint end end
不要忘记在模型中添加新字段:
translate :name, :hint
翻译自:https://stackoverflow.com/questions/7742177/rails-globalize3-gem-how-do-i-add-an-additional-field-to-the-translation-table
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- springboot~DTO字符字段与日期字段的转换问题
- Protocol Buffers 学习(2):字段类型和其他语言字段类型之间的映射
- Protocol Buffers 学习(2):字段类型和其他语言字段类型之间的映射
- PHPRAP 2.0.2 发布,接口和字段数据分离,字段使用单独数据表
- 如何正确新增字段
- HTTP缓存字段总结
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
JS 压缩/解压工具
在线压缩/解压 JS 代码
HSV CMYK 转换工具
HSV CMYK互换工具