i have a rails table setup called products and its all working well, lets assume i want to auto delete a record 3 weeks after creation how do go about the code
my produc
You need to create a cron Job, Which has to run each day at a particular time. To set up a Cron job you can use the Gem WHENEVER
And the Query should be like
Product.where("created_at <= ?", Time.now - 3.weeks).destroy_all