My solution is to use a div across the bottom of the screen, built
into the layout.
The div is attached to the bottom of the window by using fixed.
As others have done, i use styling to set the color of the div to
different colors for different messages.
The nice thing about this approach is that it if you need to be able
to get to fields underneath, you can arrange to leave some blank at
the bottom of the main screen so that it can be scrolled up, putting
any covered fields above the div.
Also, to be able to see anything below the div, I use a hover
Also, the div can expand upwards so that multiple messages can be
displayed. If the div is in the way, I have made it clickable with a
remote call to the main page which simply replaces the div content
with an empty string.
I populate the contents of the div with a partial called
all_messages. At the moment, this partial gets its content from a
helper called all_messages. This helper combines flash and error
messages. Instead of using the standard error_messages_for helper.
What I do is set a variable @errors_for in the view, which the helper
then uses to set the content for the partial that creates the div at
the bottom of the screen.
It sounds a bit complex, but it works like a dream. All I ever have
to remember to do is set the @errors_for with the models that I want
errors for, just the same as the error_messages_for helper.
Finally, I can also populate it from an ajax call by including a
page.replace_html ‘prompt’, :partial=>‘layouts/all_messages’
which will also ensure any flash or error messages are displayed from
an ajax call.
I think it can be improved by use of content for, but havn’t got round
to thinking it through quite yet.
May be of some help.