Sha256: a42f70161758337820eb33624fb1ce98bb01a02ca0542d7964645ce595a80765
Contents?: true
Size: 807 Bytes
Versions: 1
Compression:
Stored size: 807 Bytes
Contents
module Kublog module ApplicationHelper ## Nifty generators errors helper code def error_messages_for(*objects) options = objects.extract_options! options[:header_message] ||= I18n.t(:"activerecord.errors.header", :default => "Invalid Fields") options[:message] ||= I18n.t(:"activerecord.errors.message", :default => "Correct the following errors and try again.") messages = objects.compact.map { |o| o.errors.full_messages }.flatten unless messages.empty? content_tag(:div, :class => "error_messages") do list_items = messages.map { |msg| content_tag(:li, msg) } content_tag(:h2, options[:header_message]) + content_tag(:p, options[:message]) + content_tag(:ul, list_items.join.html_safe) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kublog-0.9.0 | app/helpers/kublog/application_helper.rb |