Checking days from now I'm trying to respect the Ruby principle of keeping my code dry; however, in my conditional, I have different constants set to different days. But that's the only thing different. They're pretty much the same code minus the evaluation of days from_now.

if term_type == TERM_MONTH
  subscription.suspended_at &amp;&amp; subscription.suspended_at &lt; MONTHLY_WARNING_1.from_now &amp;&amp; suspended_email_1_sent_at.nil? &amp;&amp; subscription.suspended_at &gt;= Date.today &amp;&amp; is_system == true &amp;&amp; paid_at.nil?
else 
  subscription.suspended_at &amp;&amp; subscription.suspended_at &lt; ANNUAL_WARNING_1.from_now &amp;&amp; suspended_email_1_sent_at.nil? &amp;&amp; subscription.suspended_at &gt;= Date.today &amp;&amp; is_system == true &amp;&amp; paid_at.nil?
end


I tried using the ternary operator; however, it didn't produce the results I was expecting as it was only setting the days based on term_type yet not sending the mail based on it. 

days = term_type == TERM_MONTH ? MONTHLY_WARNING_1 : ANNUAL_WARNING_1
subscription.suspended_at &amp;&amp; subscription.suspended_at &lt; days.from_now &amp;&amp; suspended_email_1_sent_at.nil? &amp;&amp; subscription.suspended_at &gt;= Date.today &amp;&amp; is_system == true &amp;&amp; paid_at.nil?


Should I stick with the if block?
Some notes:


More declarative: x.nil? -> !x
More declarative, idiomatic and compact: is_system == true -> is_system.


A first obvious refactor is DRYing the common conditions using a local variable (a temptative name, you'll know what's more fitting):

unpaid_subscription_suspended = subscription.suspended_at &amp;&amp; 
    !suspended_email_1_sent_at &amp;&amp; subscription.suspended_at &gt;= Date.today &amp;&amp; 
    is_system &amp;&amp; !paid_at

if term_type == TERM_MONTH
  unpaid_subscription_suspended &amp;&amp; subscription.suspended_at &lt; MONTHLY_WARNING_1.from_now
else 
  unpaid_subscription_suspended &amp;&amp; subscription.suspended_at &lt; ANNUAL_WARNING_1.from_now
end


A second refactor is to refactor the conditional and move all the expressions to the if/elsif predicates:

case
when !(subscription.suspended_at &amp;&amp; !suspended_email_1_sent_at &amp;&amp;
       subscription.suspended_at &gt;= Date.today &amp;&amp; is_system &amp;&amp; !paid_at)
  false
when term_type == TERM_MONTH &amp;&amp; subscription.suspended_at &lt; MONTHLY_WARNING_1.from_now
  true
when term_type == TERM_YEAR &amp;&amp; subscription.suspended_at &lt; ANNUAL_WARNING_1.from_now
  true
else
  false
end


As an additional advice, you should group those conditions into methods. For example the first chain of conditions may be abstracted as Subscription#unpaid_subscription_suspended?.