Improve delivery validation: StockArticles must not be associated more than once
This commit is contained in:
parent
5df4c8f8a6
commit
2ee7f716ae
7 changed files with 55 additions and 25 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue