data-method links don't work under nav dropdowns #343

mhuggins opened this Issue Aug 21, 2012 · 15 comments


None yet

It appears that data-method links (specifically for a :delete action to destroy a session) does not work as part of a navigation link within ul.dropdown-menu. If I copy the link code verbatim into the navigation itself (i.e.: it appears under ul.nav), then the link works perfectly fine.

The issue is only occurring when using twitter-bootstrap-rails from git master HEAD (specifically ref efc2fdc139f9, which includes the update for Twitter Bootstrap v2.1.0). If I switch back to twitter-bootstrap-rails version 2.1.1, then the issue goes away.

I've included relevant code below.


gem 'rails', '3.2.8'
gem 'jquery-rails'
gem 'devise'
gem 'therubyracer'
# gem 'twitter-bootstrap-rails', '2.1.1'                                    # this version works
gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails'   # this version fails


devise_for :users


  -if user_signed_in?
      -# This link works:
      %li= link_to 'Logout', destroy_user_session_path, method: :delete
          -# This link fails:
          %li= link_to 'Logout', destroy_user_session_path, method: :delete

The specific routing error message is:

No route matches [GET] "/users/sign_out"

Apparently something in twitter-bootstrap-rails is preventing jquery-rails from processing the data-method="delete" attribute correctly on ONLY the dropdown menu version of the link.



ericcf commented Aug 23, 2012

It's true for other methods such as :put too, and it seems to be a bootstrap issue: twbs/bootstrap#4497


I'm seeing similar issues with the nav dropdown with regular links. Probably connected to twbs/bootstrap#4497 issue.




User mfansler provided a workaround in the other issue, which works when I add it to my application.js.

  .off('click.dropdown', '.dropdown')
  .on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() });

Not ideal, but will work until Bootstrap 2.1.1 is released.

ybart commented Aug 31, 2012

Workaround confirmed working. Thanks !


I tried the workaround but didn't work! So, I just went back to v2.1.0 and it's working again!
gem "twitter-bootstrap-rails", '=2.1.0', :group => :assets

sewid commented Sep 2, 2012






javjar commented Sep 4, 2012





This should be fixed from #364



@mhuggins mhuggins closed this Sep 17, 2012

Thanks for the update, @toadkicker. I've gone ahead and closed this issue.

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