Delayed job picking attributes from table differently in different environments

北城余情 提交于 2019-12-11 13:32:52

问题


I am using delayed job to queue a Model method in another Model like this:

article_loader.rb

date_value_in_string =  "2017-06-21 07:17:00"
Article.delay(:queue => 'article_load').article_loading([date_value_in_string])

Even though I have passed a String as an argument to the method, inside the method it gets converted to Time object in the production environment.

article.rb in production environment

def self.article_loading(args)
  date_value = args[0]
  p date_value.class # Time
end

While in development environment it is a string.

article.rb in development environment

def self.article_loading(args)
  date_value = args[0]
  p date_value.class # String
end

I don't know why this happens. Any help will be appreciated.

来源:https://stackoverflow.com/questions/45035077/delayed-job-picking-attributes-from-table-differently-in-different-environments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!