title: Switching if statement for guard clause when not returning a value
body: <p>I'm adding a validation method to my Ruby on Rails model which checks the value of one field based on the value of another.</p>
  <p>The rule is that if <code>value_type == 'range'</code>, then <code>a_max</code> and <code>b_max</code> <em>must</em> be set.</p>
  <p>My method looks like this:</p>
  <pre class="lang-rb prettyprint-override"><code>def ensure_correct_type
    if value_type == 'range'
      if a_max.present? == false
        errors.add(:a_max, 'must be set for a range.'
      end
      if b_max.present? == false
        errors.add(:b_max, 'must be set for a range.'
      end
    end
  end
  </code></pre>
  <p>The code works fine, however I'm getting a rubocop warning:</p>
  <blockquote>
  <p>Style/GuardClause: Use a guard clause (return unless value_type == 'range') instead of wrapping the code inside a conditional expression.</p>
  </blockquote>
  <p>What is the correct convention for writing something like this in Ruby? The suggestion in Robocop is to do <code>return unless value_type == 'range'</code>, but that seems strange since the method doesn't return at all.</p>
  <p>I did try to implement the suggestion:</p>
  <pre class="lang-rb prettyprint-override"><code>def ensure_correct_type
    return unless value_type == 'range'
    
    if a_max.present? == false
      errors.add(:a_max, 'must be set for a range.'
    end
    if b_max.present? == false
      errors.add(:b_max, 'must be set for a range.'
    end
  end
  </code></pre>
  <p>But then I get the same warnings for <code>if a_max.present? == false</code> lines... I don't think I can do <code>return unless</code> on that line since I want to add errors for both fields if necessary.</p>
  <p>What's the best practice convention in Ruby for handling something like this?</p>