Rails delete not working in twitter bootstrap (2.1.0)

I just updated gem less-rails-bootstrap to use twitter bootstrap 2.1.0, and it seems to have broken this code in my view, in the bootstrap drop-down list:

<%= link_to 'Logout', destroy_admin_user_session_path, :method => :delete %> 

It seems the server thinks this is a GET request instead of DELETE. However, if I take this view code and put it immediately outside the drop-down list, then it works fine and the server recognizes the DELETE request.

If I change my gemfile as such:

 gem 'less-rails-bootstrap', '~> 2.0.4' 

Then run the 'bundle update' and reboot the server, then everything will work as expected. But if I just have:

 gem 'less-rails-bootstrap' 

Then run the 'bundle update' and reboot the server, then the server considers DELETE to be a GET request.

I tried switching to gitter 'twitter-bootstrap-rails' and the same problem came up. I suggest that I should do something wrong?

+7
source share
2 answers

Yes, this is Bootstrap's Twitter issue. Probably will be fixed in the next release. Here try this quick fix:

 $('body') .off('click.dropdown touchstart.dropdown.data-api', '.dropdown') .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }); 
+6
source

Others seem to have the same problem: https://github.com/twitter/bootstrap/issues/4688

A quick fix with development now looks like a devise.rb change to include:

 config.sign_out_via = :get 
+2
source

All Articles