Updated today - number of rows


#1

How can I get number of rows that was updated “today”?

Table: messages (id, title, message, updated_at)


#2

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


#3

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


#4

named_scope :recent, lambda { {:conditions => [‘updated_at > ?’,
24.hours.ago]} }

On Apr 11, 7:25 pm, Fresh M. removed_email_address@domain.invalid