Hi Tim,
I wanted to reproduce this to see if I could come up with a different
solution, but I haven't been capable of reproducing it :P.
This is my test code, I must have missed something important :)
<plans showspecialcontrols="false"/>
<def tag="plans" attrs="showspecialcontrols">
<my-table-plus:postulantes showmycontrols="&showspecialcontrols"/>
</def>
<def tag="my-table-plus" attrs="showmycontrols">
showmycontrols: <%= showmycontrols.inspect %>
this: <%= this.inspect %>
<table-plus fields="this"/>
</def>
Warm regards,
Ignacio
El 12/01/14 16:32, Tim Griffin escribi�:
> Hi all,
>
> This may seem really basic, but it tripped me up for a while because I'd
> forgotten a basic Hobo tenet: /Always be aware of context/.
>
> I'd defined a tag that calls another custom tag as follows:
>
> <def tag="plans" attrs="showspecialcontrols">
> <my-table-plus:plans fields="plan_no,
> plan_type" showmycontrols="&showspecialcontrols">
> ...
> </def>
>
>
> But, for the longest time, the highlighted attribute call generated:
>
> undefined method `showspecialcontrols' for #<#<Class:...
>
> It took me a while to realize/remember that by including "plans" in my
> call to <my-table-plus:> I'd shifted the context for the attribute I'd
> passed in. Hobo was now looking for a /showspecialcontrols/ method on a
> plan, which didn't exist.
>
> Unless someone can contribute an alternate solution, I couldn't see a
> way around this without assigning the /showspecialcontrols/ attribute to
> an instance variable:
>
> <def tag="plans" attrs="showspecialcontrols">
>
> <!-- We need an instance variable here otherwise context is confused
> within call to my-table-plus -->
> <% @show = showspecialcontrols %>
>
> <my-table-plus:plans fields="..." showmycontrols="&@show">
>
>
> Tim
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
hobousers+...@googlegroups.com.
> To post to this group, send email to
hobo...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/hobousers.
> For more options, visit
https://groups.google.com/groups/opt_out.
--
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35
Email realizado con software libre