title: Rails Field Validation Based on Value of Another Field
body: <p>I need to validate that the value of a field (:discount) is one of an array of strings. The :discount field can also be blank UNLESS the :type field is 'FixedDeal' (STI)</p>
  
  <p>validates :discount, inclusion: {in: VALID_DISCOUNTS}, allow_blank: true unless :type == 'FixedDeal'</p>
  
  <p>The above code works to validation the value of :discount, but allows the field to be blank even if the type is 'FixedDeal'.</p>