$("#errors").html(""); <% if @unit.errors.any? %> $('#errors').removeClass('hidden'); <% @unit.errors.values.each do |message| %> $("#errors").append($("
").html("<%= message.first.to_s %>")); <% end %> <% else %> $('#dialog').modal('toggle'); window.location = "<%= units_path %>"; $("#notice").html("<%= flash[:notice] %>"); <% end %>