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:
I want to set in the model hours and minutes to 00:00 when I select an option from a dropdown (a virtual attr.)Code:<%= f.time_select :duration, :minute_step => 10 %>
But this is crashing.Code:#virtual attr: def duration_type=(val) if(val == I18n.t(:days)) self.duration.hour=0 self.duration.min=0 end end
How could I do this ?



Reply With Quote
Bookmarks