title: Pundit: user_signed_in helper
body: <p>I am using Pundit to deal with authorizations. 
  I want my user's profiles to be visible by everyone so in my user_policy.rb, I have:</p>
  
  <pre><code> def show?
      true  # Anyone can view a show
    end
  </code></pre>
  
  <p>In my users/show.html.erb, the "edit profile" button is displayed only if:</p>
  
  <pre><code>&lt;% if policy(@user).update? %&gt;
    &lt;!--  show edit button  --&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>The issue is that when I try to access a profile and I'm not logged in, Pundit is looking for a "user":</p>
  
  <pre><code>def update?
    record == user || user.admin == true # Only user creator can update it
  end
  </code></pre>
  
  <p>I have an error saying that user is nil so admin is undefined. 
  I wanted to do this:</p>
  
  <pre><code>def update?
    if user_signed_in?
      record == user || user.admin == true # Only user creator can update it
    else
      false
    end
  end
  </code></pre>
  
  <p>but user_signed_in? is a devise helper, not accessible in Pundit.
  Is there an equivalent I could use or a better way to do this ?</p>