Right now I'm using the following to output error messages in my Rails 3 app. This is located in the layout view under the header:
<% flash.each do |key, value| %>
<div class="flash <%= key %>"><%= value %></div>
<% end %>
This works ok for most cases, but when I have a signin for, and the user enters invalid credentials, showing an error message in the header looks bad. It's to far from the form. And most sites show the error message right above the form?
How can I do that? Do you really have to specify this error block in all your views? Given how amazing rails is, I'm guessing there's some trick to make this work?
Thanks