How can you identify all events before and after a today in IRB?

Posted by Trip on Stack Overflow See other posts from Stack Overflow or by Trip
Published on 2010-06-07T18:32:54Z Indexed on 2010/06/07 19:02 UTC
Read the original article Hit count: 130

Filed under:

I for the life of me can't figure out the correct syntax to show the count of events before and after today.

Here's my awful and disgusting attempt:

Events.find(:all).select {|e| e.date > Time.now}.size

The trouble is the > or < operators don't work with Time.. :D

© Stack Overflow or respective owner

Related posts about ruby-on-rails