0

I've got the following code in my view file

- if user_signed_in?
  a href="/signout"
    li Sign out
- else
  a href="/signin"
    li Sign in

When a user is signed in I still only see the Sign in link; however, if I visit '/signout' route then I get the flash message that a user was signed out successfully.

How can I get this working so that when a user is signed in they see the sign out link?

Andrew Hendrie
  • 6,205
  • 4
  • 40
  • 71

1 Answers1

2

Be sure to add the following to your controller:

before_action :authenticate_user!

https://github.com/plataformatec/devise#controller-filters-and-helpers

Drew
  • 2,601
  • 6
  • 42
  • 65