The questioner
The questioner

Reputation: 724

Rails automatically delete post records

I would let users to submit posts, I just want Rails to automatically delete each and every post that are created one month ago with all its dependencies(e.g. paperclip images).

And I found some scenarios, one goes to using rake task, but it would be tedious for me to manually run the rake task every day at particular time.

The second one is using cron, but this is rather complex for me to handle.

So I wonder if there's any way to achieve this, say, when a post is one month old and then rails would automatically delete it.

Or could we give it a soft-delete(being inactive) such that it still stores in the database but search engines like google cannot fetch the specific post anymore.

Please advise.

Upvotes: 0

Views: 150

Answers (1)

user1073501
user1073501

Reputation:

For me the best solution would be to create a job or rake task for this and run it using cron. Since you find it bit complicated you might take help using whenever or rufus-scheduler

Upvotes: 1

Related Questions