I have a strange predilection. I don't like cluttering up model
classes with methods formatting data for my views. I also don't like
to repeat myself time and time again by formatting dates, currencies,
lists of names time and time again on my views. My pre-Hobo solution?
Create a facade for my model objects which either formats those
methods when called or forwards the call onward on method_missing. If
my facade inherits from BlankSlate, it quacks just like an
ActiveRecord object.

Up until the <view> tag.

Let's say I have a collection as my implicit object and I do this:

<repeat>
<view field="foo"/>
</repeat>

Works great. But I want to inject my little formatter classes. Usually
easy enough: each object has a method exposing its formatter, so I
could do collection.*.formatter and have an array to cycle through.
So:

<repeat>
<do with="&this.formatter"><view:foo/></do>
</repeat>

Ah but this doesn't work. Why? Digging through the source, I found
that this_parent inside the view tag is still set to original model
object, not the formatter. Setting this_parent explicitly is a no go
(afterwards, this_parent.class became nil).

Does anybody have any suggestions as how I can crack this little nut
and get <view/> to work with a facade to the AR object? My Hobo-Fu
isn't very good. I'm sure I could make this work if I knew the
plumbing a bit better.

Any thoughts would be greatly appreciated.
--~--~---------~--~----~------------~-------~--~----~
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