Problems with the use of time in the migration

Hi!

I created a table like this:

create_table :work_items do |t|
t.date :execution_date
t.string :section
t.integer :member_id
t.time :duration
t.text :description

t.timestamps
end

I need the duration field to enter something like HH:MM. Just the time
without a date.

When I enter it, everything seems fine… But when I return to the
edit view I see the time formatted like 2000-01-01 10:23:00…

When I create a validate method in the model to check on the input, I
allways get 2000-01-01 10:23:00, weird because I only entered 10:23…

This is the validate method in the model:

]def validate
puts duration # Results in 2000-01-01 10:23:00
end

Can anyone help me? I hoped time would work like date, with this
column I don’t have any problems…

Thhnx!

On 11 Jul 2008, at 10:51, Jolé wrote:

t.text :description
When I create a validate method in the model to check on the input, I
allways get 2000-01-01 10:23:00, weird because I only entered 10:23…

Ruby doesn’t have a pure time of day class. Just don’t display the non
time of day bit. (eg use time_select instead of datetime_select for
editing and so on)

Fred