I am building an application in rails that allows users to post products for sale for a set duration of time. Each product has a different 'end_time' in which I want to run a method that sets that updates the product status to 'dead'.
I've been reading up on the Wheneverize gem, however as far as I can tell I would use it for doing a recurring task every minute, hour, day, etc...
Any ideas on how I would go about to running a cron job that would run at each product's specific 'end_time'?
for example something along the lines of:
live_products = Product.where('status = ?', 'live')
live_products.each do |product|
at: product.end_time do
product.status = 'dead'
product.save
end
end