diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index ccc72d5..07dbe53 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -11,4 +11,9 @@ class SessionsController < ApplicationController render 'new' end end + + def destroy + reset_session + redirect_to :root + end end diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index ffb6fa9..6a7ffdc 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -13,5 +13,7 @@ = link_to 'Scube', root_path %li = link_to 'Playlists', playlists_path + %li + = link_to 'Sign out', signout_path = yield diff --git a/config/routes.rb b/config/routes.rb index 19e7381..abd30bf 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,6 +13,7 @@ Rails.application.routes.draw do resources :users, only: [:new, :create] resources :sessions, only: [:new, :create] + get '/signout' => 'sessions#destroy' resources :tracks do get 'download', on: :member