[Nitro] Nitro: cannot control the current path of a controller when skins are called

Jimmy Jazz Jimmy.Jazz at gmx.net
Tue Jun 26 11:20:02 EDT 2007


Hello list,

I'm new to nitro and ruby :)

I'm trying to build a little site with nitro, but i'm unable to control
the current path of a controller. There is something wrong when skins
are called.

The following example is certainly not the best way to use nitro, but it
describes the issue pretty well. I don't use part because the skins and
the models/controllers are too interdependent from each other.

The idea was to group files by family and to avoid them to be all placed
in src or in templates directory. More generic and sharable files will
stay in /. Like an example, i will integrate a blog or whatever in a
site. Also, the directories are organised like that,

src/  for generic controllers, skin modules, etc.

src/controllers/blog.rb
src/models/blog.rb
src/helpers/blog.rb
src/skins/blog.rb
templates/blog/

(blog.rb files are of course different)

in run.rb i have declared,

require 'src/controller'
require 'src/controllers/blog'

the blog controller src/controllers/blog.rb, contains,

require 'src/models/blog
#require 'src/skins/blog     <---------- that's is what will blow the
site ;)

and run.rb,

require 'src/controller'
require 'src/controllers/blog'
#require 'src/skins/blog     <---------- the same appends if declared in
run.rb :(

Server.map = {
  '/'     => SiteController,
  '/blog' => blogController,
  }


As far as i understood, if a controller is relative to /path it will be
the same for the models ( for example, def to_href "article/#@oid" end)
it depends on. But that is not always true, for example, if i simply add
"require 'src/skins/blog' in run.rb or in src/controllers/blog.rb, the
relative pathname for blog.rb family are then mapped to / and not to the
current directory /blog according to the "Server.map" mapping.


Thanks for your help,

Jj

-- 

            |\      _,,,---,,_
      ZZZzz /,`.-'`'    -.  ;-;;,_
           |,4-  ) )-,_. ,\ (  `'-'
          '---''(_/--'  `-'\_)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20070626/f94961b0/attachment.html 


More information about the Nitro-general mailing list