I appreciate all the feedback on this but the more I thought about it, the
more I realised I wasn't really sure what I was asking for.

I think I meant for Hobo to detect if the rich-type had particular callback
methods and, if so, to hook them into the model's read and write methods for
that field. In other words, to do automatically, what I was doing in my
example.

This behaviour could be confusing though because the application author
might have some other valid reason for wanting to override those reader and
writer methods. I don't know if there's a resilient way to do this.

Then I started to think that what I really wanted was a hook into the
view/controller layers. The <view/> tag and I think the <input/> tags
already call to_s on the object being displayed. So by overriding that in
the rich-type we're half-way there. If we could have a from_s method on the
rich type that was called when data was written we could do the conversion
there. Only, from_s would have to be a class method or a constructor because
the rich-types inherit from the base types.

At this point I read about ActiveRecord's Aggregate functionality, which
seems to overlap this somewhat, and got really confused. Which is why I
haven't logged an enhancement request on lighthouse.

I'm getting by quite nicely, for now, with my original solution: store it as
an integer and convert it in the field getters and setters.


/Ritchie

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to