Delete_All Comparison

Hello,
I’m trying to delete all rows with an older than current timestamp…
However, my code is not working… It looks like this:

@currenttime = Time.now
Import.delete_all([“created_at < ?”, @currentime])

where created_at is an automatically created timestamp in the form
2008-01-18 10:24:47. I was thinking that perhaps it is not working
because it should be in UNIX timestamp format? If so, how can I do that?
My code isn’t throwing any exceptions or anything.

Thank you very much,

  • Jeff

@currenttime = Time.now
Import.delete_all([“created_at < ?”, @currentime])

don’t know if you copy/pasted that code. there’s a typo
@currenttime/@currentime, so it would check against nil

ooooooooh man, I feel retarded now. It works perfectly… Thanks for
pointing that out!

Thorsten M. wrote:

@currenttime = Time.now
Import.delete_all([“created_at < ?”, @currentime])

don’t know if you copy/pasted that code. there’s a typo
@currenttime/@currentime, so it would check against nil

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs