2
Q
多种语言模型
A
回答
6
为此,将接近宝石globalize3。使用方便。
在你的Gemfile:
gem 'globalize'
型号:
class Article < ActiveRecord::Base
translates :title, :text
end
和迁移:
class CreateArticles < ActiveRecord::Migration
def up
create_table :articles do |t|
t.timestamps
end
Article.create_translation_table! :title => :string, :text => :text
end
def down
drop_table :articles
Article.drop_translation_table!
end
end
和运行
rake db:migrate
相关问题
- 1. Yii2多种语言
- 2. 多种语言+ Htaccess
- 3. Joomla多种语言
- 4. 汇编语言 - 多种类型?
- 5. 如何在Android中使用多种语言,如多种语言
- 6. 多种语言的多种字体
- 7. 支持多种语言
- 8. 多种语言数据
- 9. Twitter4j - 多种语言的FilterQuery
- 10. tcpdf中的多种语言
- 11. 多种语言的网站
- 12. 多种语言的帖子?
- 13. cakePhp和多种语言
- 14. 流星:多种语言?
- 15. iphone uiaccessiblity多种语言
- 16. yii2基本多种语言
- 17. 翻译为多种语言
- 18. 多种语言的PHP preg_match
- 19. CruiseControl.net有多种语言?
- 20. 多种语言的网址
- 21. SOLR索引每种语言/多种语言的SQL数据
- 22. Django-CMS中多种语言的方言
- 23. 以多种语言发言到文本
- 24. Django模型和多语种网站
- 25. 多种语言的Vista语音识别
- 26. 多种语言的文本语音
- 27. 笨多语种语言标识符
- 28. WordPress - 多站点+多种语言
- 29. 多种语言的多个首页
- 30. 两种语言
外观在此:http://stackoverflow.com/questions/6700054/rails-i18n-via-database-column – apneadiving