On 1/3/06, Ben <blee@alumni.caltech.edu> wrote:> Hi,
> I was wondering if any of you Rails/SQL ninjas knew of an elegant way
> to grab from activerecord all the rows that are within an interval of the
> current time (say in the last week). For instance, if there''s
the
> created_on datetime column, is there a zippy way to use find() without SQL?
> It seems like the Ruby
> DateTime object doesn''t really do intervals for numerous reasons.
>
> Thanks,
> Ben
Look at the time delta stuff that Typo uses:
http://typo.leetsoft.com/trac/browser/trunk/app/models/article.rb
Use it to construct a query like [''created_at BETWEEN ? AND
?'', start, end]
--
rick
http://techno-weenie.net