简体   繁体   中英

Devise Error Messages (Customization)

So i've got Devise working quite as it should, although I've mustered up few pet-peeves with the standard look of the gem.

I've sorted out most of them but the last one that I can clearly identify is the red border when there is an error message. I've uploaded a screenshot to illustrate: http://i.imgur.com/jYNmCW8.png .

How can one go about getting rid of that? or changing it to white, or blue or something?

So far the CSS code looks like:

.field_with_errors {
  display: block;
  clear: both;
margin: auto auto;
}

I've already tried background: white; and background-color: white; to no avail.

To remove the error message add following config to your config/application.rb

config.action_view.field_error_proc = Proc.new { |html_tag, instance| html_tag.html_safe }

To customize it further have a look at this SO thread Rails 3: "field-with-errors" wrapper changes the page appearance. How to avoid this?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM