Figuring out a week's time


#1

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


#2

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