I'm trying to find (and then delete) all old records in my DB on heroku.
For some reason these two are equal (notice < and >)
Post.find(:all, "updated_at > ?", 30.days.ago).count
Post.find(:all, "updated_at < ?", 30.days.ago).count
Makes me hesitent about using the delete.
What call should I make to ensure I do get only the older records?
The other answers are correct, but for updated ActiveRecord syntax:
Post.where("updated_at < ?", 30.days.ago)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With