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.
Ead43bcb0202410540a6a7cee5955d46?d=identicon&s=25 Fresh Mix (giga)
on 2009-04-11 12:42
How can I get number of rows that was updated "today"?

Table: messages (id, title, message, updated_at)
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-04-11 13:17
(Received via mailing list)
On Apr 11, 11:42 am, Fresh Mix <rails-mailing-l...@andreas-s.net>
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
Ead43bcb0202410540a6a7cee5955d46?d=identicon&s=25 Fresh Mix (giga)
on 2009-04-11 13:25
Frederick Cheung wrote:
> On Apr 11, 11:42�am, Fresh Mix <rails-mailing-l...@andreas-s.net>
> 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
1e44d920287c3e26c3d7080769b5ccb5?d=identicon&s=25 Jaryl Sim (Guest)
on 2009-04-11 17:33
(Received via mailing list)
named_scope :recent, lambda { {:conditions => ['updated_at > ?',
24.hours.ago]} }


On Apr 11, 7:25 pm, Fresh Mix <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.