From ab81cf9d5c41528e260198ad572fd1bac0d4153f Mon Sep 17 00:00:00 2001 From: Yannick Date: Tue, 7 Apr 2020 20:52:45 +0200 Subject: [PATCH] Added logout button Added logged_in helper to allow us to check whether a user is logged in to show the appropriate button --- app/controllers/application_controller.rb | 1 + app/views/layouts/application.html.erb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e288f36..1be493f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,4 +1,5 @@ class ApplicationController < ActionController::Base + helper_method :current_user, :logged_in? def require_login redirect_to login_url unless current_user.present? diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1ad564b..b48478b 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -33,7 +33,11 @@