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
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
I just discovered that exactly the same problem is already being
discussed here:
http://www.ruby-forum.com/topic/80345
Sorry for the unnecessary new thread, I’ll join the discussion on the
other one.
Wolfgang
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
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
( <> … <> )