```ruby
class SessionsController < Devise::SessionsController

  def destroy
    current_user.is_logged_in = false
    super
  end
end```

Make sure we have a valid session before trying to log the user out.
user
```ruby
class SessionsController < Devise::SessionsController

  def destroy
    current_user.is_logged_in = false if current_user
    super
  end
end```
assistant