Hi,
I have a object attr. called duration, its datatype is datetime.
I’m displaying this value using a time_select.
This generates several hidden text fields.
This is my page:
<%= f.time_select :duration, :minute_step => 10 %>
I want to set in the model hours and minutes to 00:00 when I select an option from a dropdown (a virtual attr.)
#virtual attr:
def duration_type=(val)
if(val == I18n.t(:days))
self.duration.hour=0
self.duration.min=0
end
end
But this is crashing.
How could I do this ?