in my DB, I have records with a DateTIme 'starting_at' date
in my model, I wrote a named_scope :
named_scope :planned_on_date, lambda {|aDate| {:conditions => ['state = ? AND starting_at = ?', 'planned', aDate]} }
the problem is the time... , I only need to get all planned records on a defined date aDate = aDate.to_date => Wed, 10 Dec 2008 nned to get all records at this date whatever time....
if I do Checkin.planned_on_date(aDate) then =>
is there a simple way to do that ? or should I use a range ? something like
named_scope :planned_on_date, lambda {|aBeginningDate, anEndingDate> {:conditions => ['state = ? AND starting_at BETWEEN ? AND ', 'planned', aBeginningDate.change(:hour => 0, :minutes => 0, :seconds => 0, aBeginningDate.change(:hour => 23, :minutes => 59, :seconds => 59) )]} }
all enlightment welcome
erwin