In Rails 5.
I have an Order model with description attribute. I just want to check its presence if one of two conditions is met: if the current step is equal to the first step OR, if require_validation is true.
I can easily check based on one such condition:
validates :description, presence: true, if: :first_step? def first_step? current_step == steps.first end
but I'm not sure how to go about adding another condition and checking if one or the other is true.
sort of:
validates :description, presence: true, if: :first_step? || :require_validation
Thanks!
source share