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. 哪种语言模型用于听写
- 2. Joomla多种语言
- 3. 多种语言+ Htaccess
- 4. Yii2多种语言
- 5. 汇编语言 - 多种类型?
- 6. 创建多种语言的joomla模块
- 7. 如何在Android中使用多种语言,如多种语言
- 8. 多种语言的多种字体
- 9. 多种语言的帖子?
- 10. CruiseControl.net有多种语言?
- 11. sitemap seo多种语言
- 12. Twitter4j - 多种语言的FilterQuery
- 13. 多种语言设置codeigniter
- 14. 流星:多种语言?
- 15. preg_match_all和多种语言
- 16. 翻译为多种语言
- 17. 多种语言的PHP preg_match
- 18. tcpdf中的多种语言
- 19. yii2基本多种语言
- 20. 多种语言的Jekyll
- 21. 多种语言的网站
- 22. 多种语言数据
- 23. 支持多种语言
- 24. 多种语言的网址
- 25. 多种语言在SSRS
- 26. cakePhp和多种语言
- 27. iphone uiaccessiblity多种语言
- 28. SOLR索引每种语言/多种语言的SQL数据
- 29. 以多种语言发言到文本
- 30. Django-CMS中多种语言的方言
外观在此:http://stackoverflow.com/questions/6700054/rails-i18n-via-database-column – apneadiving