# Problem with global tags

**URL:** <https://www.ruby-forum.com/t/problem-with-global-tags/68169>\
**Category:** Radiant CMS\
**Created:** [September 9, 2006, 11:37pm UTC](https://www.ruby-forum.com/t/problem-with-global-tags/68169 "2006-09-09T23:37:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wolfgang\_Wopperer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/3be4f8/32.png) [@Wolfgang\_Wopperer](https://www.ruby-forum.com/u/Wolfgang_Wopperer)\
**Post date:** [September 9, 2006, 11:37pm UTC](https://www.ruby-forum.com/t/problem-with-global-tags/68169/1 "2006-09-09T23:37:06Z")

</div>

I followed John’s advice to make tags global instead of fiddling with  
behavior inheritance, but I ran into the following problem:

I define my tags in a class that looks like this:

class Behavior::Base  
define\_tags do  
…  
end  
end

Everything is fine as long as the page on which I use the tags has no  
behavior. But when I assign Sean C.’ Commentable behavior to the  
page, I get a “undefined tag” message when visiting it.

Any idea what goes wrong here? The Commentable behavior extends  
Behavior::Base, so if I in turn extend that one, pages with the  
Commentable behavior should profit from it, or am I missing something?

Thanks for some hint in this!

Wolfgang

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Wopperer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/3be4f8/32.png) [@Wolfgang\_Wopperer](https://www.ruby-forum.com/u/Wolfgang_Wopperer)\
**Post date:** [September 10, 2006, 12:13am UTC](https://www.ruby-forum.com/t/problem-with-global-tags/68169/2 "2006-09-10T00:13:31Z")

</div>

Wolfgang Wopperer wrote:

> Everything is fine as long as the page on which I use the tags has no  
> behavior. But when I assign Sean C.’ Commentable behavior to the  
> page, I get a “undefined tag” message when visiting it.
> 
> Any idea what goes wrong here? The Commentable behavior extends  
> Behavior::Base, so if I in turn extend that one, pages with the  
> Commentable behavior should profit from it, or am I missing something?

I think this is a problem with which plugin is being loaded first. The  
way the define\_tags code works if you inherit from Behavior::Base and  
then define tags on Behavior::Base the subclass won’t get the new tags.

The fix would be to make sure that your code is required before the  
commentable behavior.

–  
John L.  
[http://wisheartdesign.com](http://wisheartdesign.com)

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Wopperer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/3be4f8/32.png) [@Wolfgang\_Wopperer](https://www.ruby-forum.com/u/Wolfgang_Wopperer)\
**Post date:** [September 9, 2006, 11:41pm UTC](https://www.ruby-forum.com/t/problem-with-global-tags/68169/3 "2006-09-09T23:41:24Z")

</div>

I just discovered that exactly the same problem is already being  
discussed here:

[http://www.ruby-forum.com/topic/80345](http://www.ruby-forum.com/topic/80345)

Sorry for the unnecessary new thread, I’ll join the discussion on the  
other one.

Wolfgang

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Wopperer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/3be4f8/32.png) [@Wolfgang\_Wopperer](https://www.ruby-forum.com/u/Wolfgang_Wopperer)\
**Post date:** [September 10, 2006, 1:50pm UTC](https://www.ruby-forum.com/t/problem-with-global-tags/68169/4 "2006-09-10T13:50:29Z")

</div>

Unfortunately (imho at least, as the Rails core team obviously is under  
a different opinion), there is no way to configure plugin load order in  
Rails. You have to resort to renaming the plugin directories like that:  
“01\_…” to “[n]_…". Because plugin directories are parsed in  
alphabetical order, the "01_…” plugin will be loaded first etc. I  
renamed my behavior directory that way and now everything works like a  
charm.

Cheers,  
Wolfgang

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Wopperer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/3be4f8/32.png) [@Wolfgang\_Wopperer](https://www.ruby-forum.com/u/Wolfgang_Wopperer)\
**Post date:** [September 10, 2006, 6:47pm UTC](https://www.ruby-forum.com/t/problem-with-global-tags/68169/5 "2006-09-10T18:47:08Z")

</div>

Rails’ conventions strike again.

Migrations imperatively work the same way (ordered by number-prefixed  
directory names).

That’s sweet knowledge. Thank you.

\*Mars

On Sep 10, 2006, at 06:50, Wolfgang Wopperer wrote:

> Cheers,  
> Wolfgang

( \<\> … \<\> )
