Mystery solved.

I found the culprit: my use of a "part" attribute on the div that contained
the tag trying to reference the attribute of the enclosing tag. And, not
having included this little detail in my original posting, that suggests
why, Ignacio, you were not able to reproduce the same issue.

So, in my full example, I should have shown my use of the part attribute:

<def tag="plans" attrs="showspecialcontrols">
  <div part="special_plans"
  <my-table-plus:plans fields="plan_no, plan_type" showmycontrols="
&showspecialcontrols">
     ...
  </div
</def>

Including the "part" attribute shifted the context for my subsequent tag
my-table-plus.

Since I've just hit this very same problem with another example, I would
really love to know *why the "part" attribute shifts context*. And, how is
specifying "part" any different than simply tagging the <div> with an ID
and using the updates="#div1,#div2" syntax. *Is "part" now an antiquated
way of doing things?*

Tim




On Mon, Jan 13, 2014 at 8:54 PM, Tim Griffin <[email protected]> wrote:

> Hey Kevin:
> Good idea, but that just produces:
>
> undefined method `showspecialcontrols' for nil:NilClass
>
> Hey Ignacio:
> How odd that you can't reproduce it. I'm currently using Hobo 2.0.1 - is
> there anything in a later version that would have altered this behaviour?
>
> So, evidently when calling my-table-plus:plans there is no "parent"
> (which I guess makes sense).
>
> Deeper in my own definition of my-table-plus, I pass an attribute on as a
> value to another custom tag with no problem (as do many other Hobo tags). This
> difference here, is that the call to <my-table> doesn't shift the context.
>
> <def tag="my-table-plus" attrs="sort-field, sort-direction, sort-columns,
> showspecialcontrols" >
>   ...
>     <my-table showspecialcontrols="&showspecialcontrols" ....>
>       <field-heading-row:>
>
> But, I'm curious why you can't replicate the behaviour....!
>
> Tim
>
>
>
> On Mon, Jan 13, 2014 at 3:05 PM, kevinpfromnm <[email protected]>wrote:
>
>> Have you tried using this_parent.showspecialcontrols?
>>
>>
>> On Sunday, January 12, 2014 8:32:10 AM UTC-7, Tim Griffin wrote:
>>>
>>> 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 a topic in the
>> Google Groups "Hobo Users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/hobousers/aHVmZTwPKn4/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/hobousers.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to