Ruby on Rails - Another Flash -


i trying show login validation errors on rails app.

i know can store errors in flash object , dump them on page this:

<% flash.each |key, value| %>     <div class="mflash flash-<%= key %>" data-module="mflash">         <%= value %>     </div> <% end %> 

but want use partial globally application.

the positioning of partial isn't want login validation errors go though.

can create flash-like variable that's stored between controller actions? (my auth actions happen on separate controller controller renders page).

i don't want hacky like:

<% flash.each |key, value| %>         <div class="mflash flash-<%= key %>" data-module="mflash">             <%= value unless (key == 'loginerrors')  %>         </div>     <% end %> 

i don't know creating flash, suspicion would end being more hacky.

why not create 2 partials , filter parts of hash deal with:

# _main_flash.html.erb <% flash.except(:loginerrors).each |key, value| %>   ... <% end %>  # _login_flash.html.erb <% flash.slice(:loginerrors).each |key, value| %>   ... <% end %> 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -