Updated today - number of rows

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

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

On Apr 11, 11:42 am, Fresh M. [email protected]
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

Frederick C. wrote:

On Apr 11, 11:42�am, Fresh M. [email protected]
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

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

On Apr 11, 7:25 pm, Fresh M. removed_emai[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs