How can I define the search scope by "this week" meaning Monday - Friday in Ruby on Rails?

Posted by Angela on Stack Overflow See other posts from Stack Overflow or by Angela
Published on 2010-05-08T16:37:15Z Indexed on 2010/05/08 19:58 UTC
Read the original article Hit count: 142

Filed under:
|

This is an extension of an earlier question. I realized, what I really want is to go to a URL /report/thisweek and it will do a .find (or named_scope) across contact_emails.date_sent where date_sent is between MONDAY and FRIDAY of the week to which Date.today belongs.

In other words, if today is THURSDAY, it will do a search for all emails MONDAY through THURSDAY of this week.

Not sure if this is doable or makes sense, but I think that's what I'd ultimately am trying to do.

Thanks!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about date