我有令人敬畏的Globalize3寶石麻煩。現在我有兩種語言:en和:ru。和:RU回落到:恩這樣通過翻譯屬性全球化3個訂單記錄,並考慮回退
#/config/initializers/globalize.rb
Globalize.fallbacks = {:ru => [:ru, :en]}
在我的控制,我想通過名稱翻譯或翻譯回退值的翻譯記錄整個集合進行排序。但with_translations()
似乎沒有給我這樣的機會!
Country.with_translations(:ru).order('country_translations.name ASC')
#this filters out those who have no :ru translations (BUT THEY SHOLD USE FALLBACKS!)
所以檢索所有記錄,我可以通過語言環境的數組:
Country.with_translations([:ru, :en]).order('country_translations.name ASC')
#but this completely ruins the sorting order (DAMN NOTHING IS SORTED)
,唯一的簡單的事情,我想是讓回退和所有togather排序!所以我們需要以某種方式獲取所有隻按可用名稱值排序的記錄。
有什麼辦法嗎?