Hi,
In my Rails application I have created an application.rhtml layout,
wich makes a reference to the FlashHash instance for message
presentation purposes. The problem is that I get the error ''undefined
local variable or method `flash'' for
#<ActionView::Base:0x610fd00>''
when parsing the script.
Is it possible to reference the flash[] hash instance in an
application-wide layout?
In my application.rhtml file I have:
<code>
...
27: <div class="frame">
28: <div><%= @frame_title || "Brasmilho" %></div>
29: <% if flash[:notice] -%>
30: <div id="notice"><%= flash[:notice] %></div>
31: <% end -%>
32: <%= @content_for_layout %>
...
</code>
And following the example at Dave and David''s beta book I have created
a method in my ApplicationController:
<code ''application.rb''>
...
private
def redirect_to_index(msg = nil)
flash[:notice] = msg if msg
redirect_to(:action => ''index'')
end
...
</code>
--
Fernando Allen Marques de Oliveira