Rails 3 & Devise: Error when logout-Collection of common programming errors
Problem solved
klaustopher his answer fixed the problem.
The problem is that i can’t logout when i have or in my layouts/application.html.erb
When i delete this line out of my application.html.erb, i am able to logout without errors. I’ve searched on google but could not find anything about this problem.
My application.html.erb:
"all" %>
Inlogd als: "flash_#{name}" %>
Piter Jelles © 2012 | Ruby on Rails
Note: i'm from the netherlands so there are dutch words in my application.html.erb
-
When you are logged out, current user will return
nil
. Calling a method onnil
will return in an error1.9.3p125 :002 > nil.username NoMethodError: undefined method `username' for nil:NilClass
You have to check if current_user returns something other than nil. You can do this by using
-
you need to check the existence of current_user like: or
Originally posted 2013-11-09 21:07:04.