[Nitro] nitro 0.50: first encounter

Jimmy Jazz Jimmy.Jazz at gmx.net
Tue Jul 3 11:47:20 EDT 2007

Hello list,

I'm trying nitro 0.50 and it is working great. I didn't have the problem
i described in a precedent post anymore. The source is even more
readable and the syntax and the organization of nitro internals are more
powerful than ever. In other words, i have try it and i'm convinced :)

Also, i have found out some "minor" strangeness. I'm not quite used to
work with nitro so I hope they are only false positives or simply (and
that is what I think) i'm not in the pink ;)

If I'm in the wrong mailing list to expose my issues and to ask for
help, just let me know where i have to post them and please, sorry for
the noise.

1. Collisions

For instance, if I name a class Menubar with a lowercase 'b' in the
skin.rb file and its associated render method contains a <div
class="menubar">, the template <Menubar></Menubar> won't render anymore
until the class name is renamed MenuBar with a uppercase 'B'. Also, the
page will be always well rendered if <div class="menubar"> is declared
inside the htmlx template file.

To illustrate the issue:

-declare a class Menubar or MenuBar in your skin.rb file: (of course,
the word menubar was used like an example)

class Menu(Bb)ar < Raw::Element
  def render
      <div class="menubar">
      <hr />

-render the Menubar/MenuBar in the template like that,

    <render href="menubar" />

The above will work, the following not:

    <render href="menubar" />

Otherwise, if the style definition <div class="..."> is instead declared
in menubar.htmlx  and not in the class itself:

<div class="menubar">
    <li class="browse_category">Choisissez une Catégorie:</li>
    <?r @labels.each do |label| ?>
        <?r if menuitem_active_on?(label.to_href) ?>
        <li class="active" id="current" title="Cette page">#{label}</li>
      <?r else ?>
        <li><a href="#{label.to_href}" accesskey="#{label.access_key}"
      <?r end ?>
  <?r end ?>
<hr />

the page is then rendered correctly, whatever upper or lowercase 'b' you
will use in the class name.

2. Question: how does #{content :method} really work ?

That is the kind of stupid question i have but i really didn't get it to
work and didn't understand how it interacts with templates. Perhaps,
some better incantations could help me :)

3. Annotation and elements

I have tried to use an annotation to link a controller to an element. In
fact, :element_namespace gives me something related to
SomeClass::Controller:yy instead of Raw::Element::yy

Also, i certainly misunderstood the annotation stuff ;)

An example to illustrate the behavior:

class Blog::Controller

  ann :self, :element_namespace => Post

doesn't return an error and is linked to Blog::Controller::Post. I think
that is wrong ( it should be Raw::Element::Post)

In opposite,

ann :self, :element_namespace => BlogPage

returns an exception,

DEBUG: File './app/controller/blog.rb' is modified
 INFO: #<NameError: uninitialized constant Blog::Controller::BlogPage>

(The class BlogPage is declared in the app/skin/blogPage.rb file and
belongs to the Raw::Element superclass, so ann should link the class
Blog to Raw::Element::BlogPage instead)

4. Just to mention it

You need to press Ctrl-C twice to stop webrick

 INFO: Stoping Webrick adapter.
 INFO: Og uses the Mysql store.
Database "aSite" dropped
 INFO: Dropped database 'aSite'
 INFO: Database 'aSite' not found!
 INFO: Created database 'aSite'
DEBUG: Og manageable classes: []
DEBUG: SELECT * FROM ogcategory
ERROR: DB error Table 'aSite.ogcategory' doesn't exist, [SELECT * FROM
./conf/debug.rb:37:in `init_og'
./conf/debug.rb:22:in `setup_og'
./conf/debug.rb:31:in `setup'
 INFO: Starting Webrick adapter on
 INFO: Press Ctrl-C to shutdown; Run with --help for options.
 INFO: Stoping Webrick adapter.

5. That is a bit Greek (Chinese?) to me

Some messages are really hard to understand and to debug and make the
source look fragile. That can be very frustrating especially if the
method are part of ruby language (e.g. each).

DEBUG: Rendering '/blog/post'
DEBUG: Compiling 'post' super-method
DEBUG: Compiling 'post' view sub-method [format: html]
undefined method `each' for nil:NilClass
  (eval):3:in `post___html___view'

6. Helper required

When i need an helper for a class,

include MenuHelper

i have to declare explicitly the pathname for the helper in the file
were include is called,

require "#{File.dirname(__FILE__)}/../helper/menu"

Also, isn't app/helper the default directory for the helpers ?

7. miscellaneous

I often get the following message on the screen. What is wrong with the
arguments ? I don't use it.

wrong number of arguments (1 for 0)


Here, we are far away from a heatwave . The local temperature is only
16°C and it is raining. ;)

Thx for you help,



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

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

More information about the Nitro-general mailing list