<%- klass = obj.class.name.demodulize.downcase -%>

<%- if obj.errors.any? -%>
	<div class="form-errors" role="alert">
		<h2><%= pluralize(obj.errors.count, 'error') %> prevented this <%= klass %> from being saved:</h2>

		<ul>
			<%- obj.errors.messages.each do |field, message| -%>
				<li id="<%= field %>-errors"><%= link_to field.capitalize, %{##{klass}_#{field}} %> <%= message.join(', ') %>.</li>
			<%- end -%>
		</ul>
	</div>
<%- end -%>
<%- klass = obj.class.name.demodulize.downcase -%>

<%- if obj.errors.any? -%>
	<div class="form-errors" role="alert">
		<h2><%= pluralize(obj.errors.count, 'error') %> prevented this <%= klass %> from being saved:</h2>

		<ul>
			<%- obj.errors.messages.each do |field, message| -%>
				<li id="<%= field %>-errors"><%= link_to field.capitalize, %{##{klass}_#{field}} %> <%= message.to_sentence %>.</li>
			<%- end -%>
		</ul>
	</div>
<%- end -%>
Use Array to_sentence method for displaying form errors.
Use Array to_sentence method for displaying form errors.
