title: Ruby unless && statement
body: <p>I have the following in my application_controller.rb</p>
  
  <pre><code>def layout
    unless request.subdomain.empty? &amp;&amp; current_user.nil?
      self.class.layout 'admin'
    end
  end
  </code></pre>
  
  <p>It seems the code above it's not working. But when I do the following, it does work.</p>
  
  <pre><code>def layout
    unless request.subdomain.empty?
      unless current_user.nil?
        self.class.layout 'admin'
      end
    end
  end
  </code></pre>
  
  <p>I would like to simplify the code by removing one unless statement. How could I do that?</p>