List Info

Thread: @template_root problem with subclasses and specific sequence of actions




@template_root problem with subclasses and specific sequence of actions
user name
2006-07-31 17:20:42
Basically a code like this:

----8<------
class SuperController < Nitro::Controller
  def setup_template_root(path)
   template_root=[somepath]
  end
end

class SubController < SuperController
  def setup_template_root(path)
   template_root=[some other path]
  end
end

System.map['/super']=SuperController
System.map['/super/sub']=SubController
------->8--------


Notice that everything works fine if SubController does not
inherit from 
SuperController.

Now, if I access
  /super/sub/index
and then
  /super/index/
everything works fine.

If, on the other hand, I access
  /super/index/
first, and just later
  /super/sub/index
everything goes mad, because the templates for the latter
got searched 
in the template_root of the first.

I've been trying to fix this for a lot but I have no idea
of what is 
happening. When the application starts the template_root is
calculated 
in Publishable.mount_at and it seem to be set up correctly,
but then 
things fail if I follow that specific sequence of access.
BTW, this seem somehow similar to a bug notifed from
zimba.tm some 
months ago. If someone has any kind of clue, could you share
it?


While we're at it: do I recall correctly that just doing
  template_root =[something]
in a controller is deprecated ?
If it's not, then there is a bug in Publishable.mount_at
where it gets 
reset to [] unconditionally.

Cheers

-- 
blog en: http://www.riffraff.info
blog it: http://riffraff.blogsome
.com
jabber : rff.rff at gmail dot com

_______________________________________________
Nitro-general mailing list
Nitro-generalrubyforge.org
h
ttp://rubyforge.org/mailman/listinfo/nitro-general
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )