Forum: Ruby on Rails Updated today - number of rows

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fresh M. (Guest)
on 2009-04-11 14:42
How can I get number of rows that was updated "today"?

Table: messages (id, title, message, updated_at)
Frederick C. (Guest)
on 2009-04-11 15:17
(Received via mailing list)
On Apr 11, 11:42 am, Fresh M. <removed_email_address@domain.invalid>
wrote:
> How can I get number of rows that was updated "today"?
>
> Table: messages (id, title, message, updated_at)

Decide on your precise definition of today (since midnight, last 24
hours etc.) and use ActiveRecord's count method.

Fred
Fresh M. (Guest)
on 2009-04-11 15:25
Frederick C. wrote:
> On Apr 11, 11:42�am, Fresh M. <removed_email_address@domain.invalid>
> wrote:
>> How can I get number of rows that was updated "today"?
>>
>> Table: messages (id, title, message, updated_at)
>
> Decide on your precise definition of today (since midnight, last 24
> hours etc.) and use ActiveRecord's count method.
>
> Fred

I think that last 24 hours is better
Jaryl Sim (Guest)
on 2009-04-11 19:33
(Received via mailing list)
named_scope :recent, lambda { {:conditions => ['updated_at > ?',
24.hours.ago]} }


On Apr 11, 7:25 pm, Fresh M. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.