How to save time and compare only the hour & minute part?

My model Enrollment has a time field called delivery_time. How do I
set it to 8:00AM?

In my migration, I had it do:

t.time :delivery_time, :default => “8:00AM”

But when I go into the console and output the value of delivery_time,
it spits out “Sat Jan 01 08:00:00 +0000 2000”

Why is it doing this?

WHAT I’M TRYING TO DO:

What I want to do is have a condition statement like this:

ModelName.find(:all, :conditions => [":delivery_time = ?",
Time.now.hour]

Here is some context:

My app sends out an email every day to it’s users with some info. When
the user signs up, they decide what time they want to recieve their
daily email.

The subscription is managed by a model called Enrollment, which has
the fields last_deliver_date and delivery_time.

I need to create Enrollment.due that return all enrollments that have
a last_delivery_date older than 1 day and has a delivery_time that is
within 1 hr of now

On Tue, 2008-06-10 at 19:06 -0700, mel ram wrote:

a last_delivery_date older than 1 day and has a delivery_time that is

But when I go into the console and output the value of delivery_time,
it spits out “Sat Jan 01 08:00:00 +0000 2000”

Why is it doing this?

WHAT I’M TRYING TO DO:

What I want to do is have a condition statement like this:

ModelName.find(:all, :conditions => [":delivery_time = ?",
Time.now.hour]


I’m still a bit vague on what you are trying to accomplish overall -
i.e. is this a one time shot e-mail or will this recycle but anyway…

I would probably have a date field for the sending date and a number
field for the hour 0…23

and then I would find_all == hour and run this on an hourly basis
(gathering what I can from above)

Craig