mardi 11 juillet 2017

Delayed job picking attributes from table differently in different environments

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.

Aucun commentaire:

Enregistrer un commentaire