Customize Field Errors with Rails 5 & Bootstrap 4

Building a new app for one of my clients I had the need to customize Rails’ internal form error fields. By default Rails will add the field_with_errors class to an invalid input and call it a day. Unfortunately, if you’re using Bootstrap 4 (I’m using Beta) then you’re going to need to do a lot of customization in order for this to look right.

But, I hate trying to fight Bootstrap, so I set about trying to make Rails and Bootstrap play nice. I adapted this solution from rubyplus.org to work with the new Bootstrap 4 layouts. The gist is available on my github: Customize Field Errors with Rails 5 and Bootstrap.  It’s pretty simple, but here’s what you need to do.

Like I said, pretty simple but it makes things look a lot more snazzy.

What do you think? Comment here or on the gist to let me know what you think. Enjoy!

2 thoughts on “Customize Field Errors with Rails 5 & Bootstrap 4

Leave a Reply

Your email address will not be published. Required fields are marked *

*