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.
Mike D. (Guest)
on 2007-02-07 15: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
Bill S. (Guest)
on 2007-02-07 17: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 S.
http://www.jadecove.com

On Feb 7, 8:54 am, Mike D. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.