[Nitro] render.rb stange methods

transfire at gmail.com transfire at gmail.com
Sun Feb 11 16:21:58 EST 2007

On Feb 10, 4:18 pm, "George Moschovitis"
<george.moschovi... at gmail.com> wrote:
> please, show me the build_form method source code.

okay. well, it's little complicated since I'm using facets builder
(with one midification since 1.8.20) and had to change some of nitro
to use it. but i'll see what i can do. in the mean time i'll see if I
can't get any more clues.

one question about the builder. compared to _why's markaby lib there
is a difference between the two. markaby imports the helper module
verbatium -- ie. it's methods are callable without any special
convention. For example say we're using this helper:

  module AHelper
    extend self
    def foo; "FOO!"; end

With markaby we might have:

  builder.html {
    h1 "hello"

to do the same with Facets, it prefixes the methods by build_:

  builder.html {
    h1 "hello"

The basic reason why being that markaby only allows standard html
tags. If you try to insert an arbitrary tag you will get an error. To
get around this you have to use the tag! method. Facets' on the other
hand allows any tag whatsoever (minus a handful of special keywords),
so to avoid name clashes I use a prefix.

Which way is better? Should I get rid of the prefix? And still allow
the arbitrary tags? in a way i would like to but take nitro's
FormHelper which defines a form method --that's going to clash with
creating an ordinary form tag. does it matter --maybe the helper
method should hacve a more specidic name like entity_form?

i was wondering also. might it just be better to use _why's Markaby
lib? since it's not really the typical usage, markaby could just be
optional it's no biggy to me either way really, facets' building code
is capable enough i believe, and is pretty much the same as markaby in
functionality, but it is sort of reinventing the wheel in most
respects, so if this isn't going to get much use is it worth it?


More information about the Nitro-general mailing list