How to access current user with Devise
<p>I am using devise as well as ldap in my application to authenticate users. I have got the users model set up as well as devise. I can properly sign in and sign out users but I cannot access any information for the devise built in helper; current_user.</p>

<p>I want the main page of the application to show the current users name at the top of the page. I have created the column in the users table called display_name. </p>

<p>This is the code that I want to work:</p>

<pre><code>&lt;% if user_signed_in? %&gt;
 &lt;div&gt; &lt;%= current_user.display_name %&gt; &lt;/div&gt;
&lt;% end %&gt;
</code></pre>

<p>When I used byebug and try to access the current user it returns nil. </p>

<p>Does anyone have any suggestions on how I can access the current users information?</p>

<p><strong>Update</strong></p>

<p>I tried using:  <code>&lt;% if signed_in %&gt;</code>
but i still get the same error: undefined method `display_name' for nil:NilClass </p>