[Rails] Re: Question about a date range selector

2009-06-29 Thread Älphä Blüë
Ä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.. -- Posted via http://www.ruby-forum.com/

[Rails] Re: Question about a date range selector

2009-06-29 Thread Älphä Blüë
Matt, good call there mate. I created some constants for each week start and end: WEEK_ONE_START = "2009-06-21" WEEK_ONE_END = "2009-06-27" And then defined that in a per search scope: named_scope :compiled_week_one, lambda { { :conditions => ['compiled_on > ? and compiled_on < ?', WEEK_TWO_S

[Rails] Re: Question about a date range selector

2009-06-29 Thread Matt Jones
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 seeing. --Matt Jones On Jun 28, 9:02 am, "Älphä Blüë" wrote: > I was playing around with di

[Rails] Re: Question about a date range selector

2009-06-28 Thread Älphä Blüë
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 th