Search code examples
ruby-on-rails-pluginsruby-on-rails-3

How to change devise's sign out to use POST instead of GET?


I noticed that the sign out action of devise uses GET (I think the best practice is to put all data state-changing actions behind a POST)

So how do I change the route to use a POST instead of a GET ? (Ideally without having to copy the controller code if at all that is needed)

Here's the rake route for the current devise sign out path (wrapped on two lines):

destroy_user_session GET    /users/sign_out(.:format)
         {:controller=>"devise/sessions", :action=>"destroy"}

Solution

  • Found it! Latest devise version (v1.2.rc-10) has an option called :sign_out_via (link)