You can override the assignment operator for the particular field to
be able to do your particular logic on assignment.  Then just do a
write_attribute to save your info in the field.  I don't know if that
covers all the ways hobo might try to create a new model or not
though.  I haven't had any problem with an 0.7.5 app that uses that
technique though.

On Jun 10, 8:49 pm, Ritchie Young <[email protected]> wrote:
> 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