Forum: Ruby on Rails figuring out a week's time

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.
39025a7f572d6fe464e1fe6be399ca3b?d=identicon&s=25 Mike Dershowitz (mdersh53)
on 2007-02-07 14:54
Hello:

I have some data in my database that is updated daily.  When i present
this data to the

user, however, I want them to see only the data for the week that they
are currently in.

Each row in the table in which the data resides has a timestamp, so it's
no trouble finding

out when the row was inserted, it's just trouble finding out how to
create a query based on

a time of now when now is used only to figure out the week we're in.

Does rails have something built-in for this?  I assume this is something
I would put in my

model and then use in my query in my controller or view?

Thanks very much in advance for your help.

Mike
456f5e099eb136439d751598e32d8607?d=identicon&s=25 Bill Siggelkow (Guest)
on 2007-02-07 16:23
(Received via mailing list)
You want to use a BETWEEN query using something like
Time#beginning_of_week and Time#next_week documented at http://
api.rubyonrails.com/classes/ActiveSupport/CoreExtensions/Time/
Calculations.html#M000338.

-Bill Siggelkow
http://www.jadecove.com

On Feb 7, 8:54 am, Mike Dershowitz <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.