jeudi 6 juillet 2017

String value gets converted to Time object when a model method is called using delayed job

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.

article.rb

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

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

Aucun commentaire:

Enregistrer un commentaire