# Delete\_All Comparison

**URL:** <https://www.ruby-forum.com/t/delete-all-comparison/126501>\
**Category:** Rails\
**Created:** [January 18, 2008, 7:36pm UTC](https://www.ruby-forum.com/t/delete-all-comparison/126501 "2008-01-18T19:36:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sithadmin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@sithadmin](https://www.ruby-forum.com/u/sithadmin)\
**Post date:** [January 18, 2008, 7:36pm UTC](https://www.ruby-forum.com/t/delete-all-comparison/126501/1 "2008-01-18T19:36:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sithadmin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@sithadmin](https://www.ruby-forum.com/u/sithadmin)\
**Post date:** [January 18, 2008, 8:32pm UTC](https://www.ruby-forum.com/t/delete-all-comparison/126501/2 "2008-01-18T20:32:19Z")

</div>

> @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

---

<div class="post-metadata">

**Author:** ![sithadmin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@sithadmin](https://www.ruby-forum.com/u/sithadmin)\
**Post date:** [January 18, 2008, 9:11pm UTC](https://www.ruby-forum.com/t/delete-all-comparison/126501/3 "2008-01-18T21:11:14Z")

</div>

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
