[英]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.