trying to understand the delayed_job in Rails, I want to update all PIN which already expired in my gallery
class UpdatePinJob < ApplicationJob
queue_as :default
def perform(gallery)
gallery.where('DATE(expired_pin) > ?', Date.today).update_all('pin = ?', 'new_pin_here')
end
end
is that the correct way to use the job? and how do I call it then in my controller? I hope my question makes sense, why I use a queue for this case because I was thinking how if my galleries have thousands, and I want to update all, that was I was thinking to use delayed_job might help for this to scale it :) if something wrong on my question sorry, I am here trying to understanding