RailsTutorial and Failing Dropdown Menus

Rails on Mac ImageI’m working my way through the very excellent RailsTutorials by Michael Hartl and ran into a problem I thought I’d not here related to gem versions and the 3.2 version of the book.

Throughout the book I was having problems with the twitter bootstrap dropdown menus not working.   It doesn’t become a problem until user sessions later on but when I got there I tried a little troubleshooting.

Checking out the javascript console I found the error:

cannot read property 'webkit' of undefined bootstrap

Which the nice folks over on StackOverflow point out is a version change in query that no longer supports the way one of the methods are called.  If you use a current version of the jquery-rails gem this means bootstrap dropdowns don’t work. the recommended version from the book is 2.0.0 but that has been pulled due to bugs.

To a Ruby and Rails Noob like me (RoobNoob?) it’s not apparent but using the line in your Gemfile

gem 'jquery-rails', '~> 2.0.0'

Will automatically load the latest bug fix in the 2.0.x line, which is 2.0.3 at the time of this post.  Presumably using current versions of jquery-rails and bootstrap-sass would get around this problem but I want to complete the full tutorial before I do much off-roading.