Bootstrap Dropdowns in Rails

I've been meaning to write my first blog post, but have a hard time stepping away from my own learning for a moment to share something I've learned. With that said, this is going to be short and sweet (but hopefully prevent some headaches)!

There seems to be some inconsistency between the development and production environments with how the Twitter Bootstrap Rails gem is being handled in the Rails Javascript manifest file. The solution I've come up with (thanks to some help from Stackoverflow) is simple.

In development, make sure you're including bootstrap first!

//= require bootstrap
//= require jquery
//= require jquery_ujs

In production, make sure you're including jQuery first!

< title="application.js">
//= require jquery
//= require jquery_ujs
//= require bootstrap

Simple as that... you're Bootstrap dropdown should now work depending on your environment.

Written on June 26, 2013