diff --git a/context/app/controllers/sessions_controller.rb b/context/app/controllers/sessions_controller.rb index 4bf8d25..1d6bfa3 100644 --- a/context/app/controllers/sessions_controller.rb +++ b/context/app/controllers/sessions_controller.rb @@ -19,7 +19,13 @@ def create end def destroy - + if current_user.id == params[:id].to_i + session.delete :user_id + redirect_to root_path, notice: 'Вы успешно разлогинились' + else + redirect_to root_path + flash[:error] = 'Вы кого выйти хотите?' + end end end diff --git a/context/app/views/layouts/application.html.erb b/context/app/views/layouts/application.html.erb index f54b749..b3bebe6 100644 --- a/context/app/views/layouts/application.html.erb +++ b/context/app/views/layouts/application.html.erb @@ -10,7 +10,15 @@