Created
January 7, 2011 16:11
-
-
Save ckdake/769663 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DeviseHelper | |
def devise_error_messages! | |
unless resource.errors.empty? | |
content_tag :div, :id => "error_explanation", :escape => false do | |
content_tag(:h2, "The following errors were encountered:") + | |
content_tag(:ul, resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join.html_safe) | |
end.html_safe | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like you could probably do something like content_tag(:div, [...], {:id => '...'}, false) .. false being escape = false .. but that's pretty uglified? Maybe Ruby will have named arguments someday :)
Well, actually, named arguments may not help here unless you still used the block syntax or just wanted more clarity.