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