Rails automatically appends a dummy date when you use the TIME type on your database. My point is: if you are using a time data type on your database, you are doing that exactly because you don't want the date included.
Anyway, I am storing a integer column with the total seconds on the database and then transforming that with composed_of. Is there a better way to do that? Anyone know if there is a gem or something to handle cases like these?
Time without date is useless and extremely prone to error. Internally time is stored as millisecond offsets from a reference date (e.g. UNIX time is the number of milliseconds from midnight January 1, 1970 UTC). The date and time related objects in Ruby depend on this underlying offset.
a value of 14:00 is meaningless without relating that to some date, in some time zone, and applying the geopolitical rules for daylight savings (or other adjustments to the normal flow of time).
Just for the sake of argument... how about the time it takes runners to finish a marathon? Sure you could use seconds as an integer field, but time without date make sense...
I agree that "4pm" is kind of pointless, but "16 hours" can be handy.
If only to save me from having to convert from seconds to hh:mm:ss and back, etc...
-philip