Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8026487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:30:26+00:00 2026-06-04T23:30:26+00:00

Problem solved klaustopher his answer fixed the problem. The problem is that i can’t

  • 0

Problem solved

klaustopher his answer fixed the problem.


The problem is that i can’t logout when i have <%= current_user.email %> or <%= current_user.username$> 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:

<!DOCTYPE html>
<html id="html">

<head>
<title><%= content_for?(:title) ? yield(:title) : "Contractbeheersysteem" %></title>
    <%= stylesheet_link_tag "application", "simple_form", "gegevens", "drop-down-menu",      "table", :media => "all" %>
    <%= javascript_include_tag "autocomplete-rails.js" %>
    <%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js", "application" %>
    <%= javascript_include_tag 'jquery.dataTables.min' %>
    <%= csrf_meta_tag %>
    <%= yield(:head) %>
</head>

<body>

<body link="#999" vlink="black" alink="black">  

<div id="menu">
    <ul id="drop-down-menu">
    <li><%= link_to "Home Page", home_index_path, :class => current_page?(home_index_path) ? "current" : "" %></li> 
    <li><%= link_to "Bedrijfsgegevens", bedrijfsgegevens_path, :id => 'bednav' %>
    <ul>
        <li><%= link_to "Nieuw Bedrijf toevoegen", new_bedrijfsgegeven_path %></li>
    </ul> 
    </li> 
    <li><%= link_to "Contactpersonen", contactpersoons_path, :id => 'contanav' %>
    <ul> 
        <li><%= link_to "Nieuw Contactpersoon", new_contactpersoon_path %></li> 
    </ul> 
    </li>
    <li><%= link_to "Contractgegevens", contractgegevens_path(@contractgegevens), :id => 'contrnav' %>
    <ul> 
        <li><%= link_to "Nieuwe Contractgegevens", new_contractgegeven_path %></li> 
    </ul>
        <li><%= link_to "Contactformulier", contact_index_path, :id => 'formnav' %>        </li>
    <% if user_signed_in? %>
        <li><%= link_to "My Account", users_path(@users) %>
        <ul>
            <li><%= link_to "Uitloggen", destroy_user_session_path, :method => :delete %>
            <li><%= link_to "Gebruikers", user_registration_path %>
        </ul>
    <% else %>
        <li><%= link_to "Inloggen", new_user_session_path %>
        <ul>
            <li><%= link_to "Registreren", new_user_registration_path %>
        </ul>
    <% end %>
    </ul>   
  <p class="clear_all"></p>
</div>

<div id="login">
Inlogd als: <%= current_user.username %>
</div>

<div id="content">
  <hr>
    <% flash.each do |name, msg| %>
    <%= content_tag :div, msg, :id => "flash_#{name}" %>
    <% end %>
    <%= yield %>
 </div>

 <div id="footer">
    <hr color="#999", width="100%">
    <h4>
    <b><a href="http://piterjelles.nl">Piter Jelles</a> &copy; 2012 </b> | <a href="http://rubyonrails.org">Ruby on Rails </a> 
    </h4>
 </div>

 </font>    
 </body>
 </div>
 </html>

Note: i’m from the netherlands so there are dutch words in my application.html.erb

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:30:28+00:00Added an answer on June 4, 2026 at 11:30 pm

    When you are logged out, current user will return nil. Calling a method on nil will return in an error

    1.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

    <%= current_user.username if current_user %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Updated Problem solved, I have some design problem here. The directory looks like that:
(Problem solved, please see the updates) I have some files that have incorrect filenames
Problem solved: Thanks guys, see my answer below. I have a website running in
Problem solved, see below Question I'm working in Flex Builder 3 and I have
[EDIT: Problem solved. Please see my answer below.] In my app I call the
PROBLEM SOLVED: I was overlooking a very simple issue, and that is that this
I have been on SO for awhile now trying to get this problem solved
I have this problem, that usually api entry point works fine: https://www.google.com/analytics/feeds/accounts/default but when
Problem solved by Shawn Chin in Answer 1 . And what drives me crazy
I've read & tried a few posts but can't get this problem solved. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.