Question about a date range selector

All of my stat tables house data that is compiled weekly. I know how to
add a date range selector to the table but I'm not sure how I can
restrict the selector to show specific weeks only unless I use a
symbolic type of selector.

For instance:

Suppose there are 13 weeks in a season. Data is added each of the 13
weeks. A person wants to view just the data from week 1. In my table
week 1 would have been between the date ranges of say Aug 31 - Sep 6.

Should I just use a symbolic selector instead with options for say:
Week 1
Week 2
Week 3...

And then provide a case for when that week is selected it is sent over
to a defined named_scope for that particular week?

I'm just thinking about possibilities and what might be a better way of
doing things.


I was playing around with distinct and tried the following:

<%= collection_select(:rushing_offense, :compiled_on,
RushingOffense.find(:all, :select => 'DISTINCT compiled_on'), :id,
:compiled_on, {:prompt => true}) %>

With my current week's data for instance there are 120 timestamps.
Using the above, it pulled 2 options only (which is not bad but also not
good). The difference was within a second apart:

Please Select--
2009-06-28 12:08:40 UTC
2009-06-28 12:08:41 UTC

Probably because it took a second to load the batch. I would rather
work with something like this but tailor it some more..

I'll see what I can work out but if anyone has better ideas please let
me know.


One thing - if you're only ever going to be interested in the date,
I'd recommend changing the compiled_on field to a date, rather than a
datetime. That will eliminate the "off by 1 second" thing you're

--Matt Jones

Älphä Blüë wrote:

And then defined that in a per search scope:

named_scope :compiled_week_one, lambda { { :conditions => ['compiled_on

? and compiled_on < ?', WEEK_TWO_START, WEEK_TWO_END] } }

Actually reads WEEK_ONE_START and WEEK_ONE_END..