Skip to content

Instantly share code, notes, and snippets.

Created September 16, 2013 10:50
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Devise Error Messages Twitter Bootstrap style
# /app/helpers/devise_helper.rb
module DeviseHelper
def devise_error_messages!
return '' if resource.errors.empty?
messages = { |msg| content_tag(:li, msg) }.join
sentence = I18n.t('errors.messages.not_saved',
count: resource.errors.count,
resource: resource.class.model_name.human.downcase)
html = <<-HTML
<div class="alert alert-error alert-block">
<button type="button" class="close" data-dismiss="alert">x</button>
Copy link

nihsmik commented Jul 15, 2015

alert-error becomes alert-danger :)
And alert-block is not needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment