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