Sha256: 2f8bbb465cb3d11bdd1f8151587c735fc7d5b44b3b96856430113d181daa05fc
Contents?: true
Size: 651 Bytes
Versions: 45
Compression:
Stored size: 651 Bytes
Contents
module RailsConnector module ErrorMessagesHelper # Shortened error_messages_for from git://github.com/rails/dynamic_form.git def error_messages(*objects) objects.compact! count = objects.inject(0) {|sum, object| sum + object.errors.count } return '' if count.zero? content_tag(:div, :class => 'errorExplanation') do c = ''.html_safe c << content_tag(:ul) do li = ''.html_safe objects.each do |object| object.errors.full_messages.each do |msg| li << content_tag(:li, msg) end end li end end end end end
Version data entries
45 entries across 45 versions & 1 rubygems