Improve delivery validation: StockArticles must not be associated more than once

This commit is contained in:
Julius 2013-06-26 17:56:20 +02:00
parent 5df4c8f8a6
commit 2ee7f716ae
7 changed files with 55 additions and 25 deletions

View file

@ -158,5 +158,13 @@ module ApplicationHelper
end
flash_messages.join("\n").html_safe
end
# render base errors in a form after failed validation
# http://railsapps.github.io/twitter-bootstrap-rails.html
def base_errors resource
return '' if (resource.errors.empty?) or (resource.errors[:base].empty?)
messages = resource.errors[:base].map { |msg| content_tag(:li, msg) }.join
render :partial => 'shared/base_errors', :locals => {:error_messages => messages}
end
end