No you do not have to write a script for destroy_user_session
. This is handled by the destroy action of the devise's SessionsController
which is already available since you've installed devise gem. unless you want to change the default behavior of destroy
action, all you need is a link to the action on your view to destroy the session like this:
<%= link_to 'Sign out', destroy_user_session_path, :method => :delete %>
and devise will destroy the current session