title: How to correctly use guard clause in Ruby
body: <p>What is the correct way to use the guard clause in this sample?</p>
  
  <pre><code>def require_admin
    unless current_user &amp;&amp; current_user.role == 'admin'
      flash[:error] = "You are not an admin"
      redirect_to root_path
    end        
  end
  </code></pre>
  
  <p>I don't know where to put flash message when trying to rewrite using these <a href="https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals" rel="noreferrer">https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals</a> conventions</p>