Reputation:
I'm creating a simple paste-bin in Ruby on Rails, which will have an expire-feature. With this, people can select a date when the paste will be deleted automatically. How can I implement this? I was thinking of a cronjob
, but maybe there is a more platform-independent way, by defining this in the model itself.
Upvotes: 1
Views: 912
Reputation: 17790
cron
will work fine. You can make a Rake
task that performs the actual deletions, and then trigger that from cron
.
Alternatively, you could keep the data forever and simply quit showing any records that have expiration dates in the past.
Upvotes: 2