title: Ruby on Rails: undefined method, checking boolean if true statement
body: <p>I have a page where I'm checking to see if the database column <code>public</code> is true or if a user is admin. </p>
  
  <pre><code>&lt;% if @user.public || current_user.admin %&gt;
    ... users page ...
  &lt;% end %&gt;
  </code></pre>
  
  <p>The issue right now is that if I'm not logged in, then its checking if <code>current_user.admin</code> is true, so I get a <strong>NoMethodError</strong></p>
  
  <blockquote>
    <p>undefined method `admin' for nil:NilClass</p>
  </blockquote>
  
  <p>What is the most logical syntax so I can check if its public or admin if I'm not logged in, so it should direct to a noticed page instead of getting this error.</p>
  
  <p>Thanks</p>