Search code examples
datetimeruby-on-rails-4sidekiq

Rails Sidekiq worker preform_in with dynamic interval number


For the Worker.perform_in(1.hour) method how could I write it so that the number 1 was a dynamic variable?

I would like to write something like: Worker.perform_in(a.hours)


Solution

  • What you wrote will work fine:

    a = 1
    Worker.perform_in(a.hours)