In my Rails 3 app I have the following partial to display error messages in the main layout:
<% flash.each do |name, msg| %>
<% if msg.is_a?(String) %>
<div class="alert alert-<%= name == :notice ? "success" : "error" %>">
<a class="close" data-dismiss="alert">×</a>
<%= content_tag :div, msg, :id => "flash_#{name}" %>
</div>
<% end %>
<% end %>
I am using JQuery to call create method and created a create.js.erb which is run succesfully after creating the model or after validating with errors.
The question is: how do I go about displaying the list of validation errors in my partial from create.js.erb file? Or ... can that be done from the controller?
Thanks