[英]I18n together with clockwork
當從發條方法調用模型方法“ model_method”時,I18n.locale始終等於我的默認語言環境。
如何將當前語言環境傳遞給模型方法?
clockwork.rb
:
every(10.minutes, 'test') do
Book.delay(:queue => 'some_queue').model_method
end
book.rb
:
def self.model_method
...
message = I18n.t('some_text')
# always equals to ":en"
end
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.