On Jun 7, 7:32 pm, Ritchie Young <[email protected]> wrote: > > An example would be currency. I want to store an amount of money in > cents but allow it to be entered and display it in a (culturally > insensitive) dollars.cents format.
I've been away from Hobo for a while (my work laptop was stolen) but this is exactly what I do with my Hobo cents type. Here's the code: http://gist.github.com/127101 Values get stored as cents in an integer field in the db, get loaded as Ruby fixnums, and get converted for display. I might be missing something but I don't understand why you want to convert for storage rather than display. Something I would like is the ability to save a single type to multiple db columns. That way the cents type could have both a cents value and a currency type value. I had thought about using the cents type for a cookbook recipe back when I first wrote it, but now that we have hobo-contrib it might be a good idea to add a section for rich types to that. Thoughts Bryan? -david --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hobousers?hl=en -~----------~----~----~----~------~----~------~--~---
