[Nitro] How iterate efficiently through collection of 'things'?

Aleksi Niemela Aleksi.Niemela at cs.helsinki.fi
Mon Sep 5 16:34:53 EDT 2005

George Moschovitis kirjoitti:

>>used on temporary storage either, it's too short living. OTOH, Nitro
>>discourages using session object and using state that's not persistent
>>at all, like said at Nitro::Session rdocs
>Nitro discourages the usage of session variables but provides the session object
>for problems like the one you describe. For example you could use a
>MemoryStore backed Session to store the results.
Thanks for the recent replies. Related to this one I have a problem. I 
don't know how to use Flash.

In my login_check action I say:

        flash[:invalid_login] = true
        render "login"   # or originally redirect, but no effect

In login.xhtml I have

    p flash
    if flash[:invalid_login] ?>
    <div class="invalid_login">
      <h2>Invalid login</h2>
  <?r end ?>

The flashed information won't show in login.xhtml, instead flash is 
empty. I think I'm inside one request, just diverting into another 
"action" when failing login. But probably I'm in two request so Flashing 
won't work. And no, I don't think I'm going to merge login_check into 
login and determine from empty parameter if I'm coming to login page 
first time or after sent form. It's cleaner and more self-documenting 
this way.

Using session works probably ok. So I guess one should use Flashing for 
one action + .xhtml -pair.

If that's so, what's the use of the concept? I use @invalid_login type 
of variables to carry useful information into xhtml files. If instance 
variable naming pollution becomes an issue, it's not hard to set @flash 
= {} (or openstruct or something) and carry info through it. But 
pollution hasn't been a problem. Or am I misunderstanding something?

    - Aleksi

More information about the Nitro-general mailing list