Scopes chaining by OR How can I DRY these scopes?

  scope :reputed, -&gt; {
    joins{reputations.outer}.
    where{['coalesce(rs_reputations.value, 0) &gt; ? OR purchases.force_active = ?', LOWEST_VOTE, true]}
  }

  scope :reputed_or_mine, -&gt;(user) {
    joins{reputations.outer}.
    where{['coalesce(rs_reputations.value, 0) &gt; ? OR purchases.force_active = ? OR purchases.user_id = ?', LOWEST_VOTE, true, user.id]}
  }
'coalesce(rs_reputations.value, 0) &gt; ? OR purchases.force_active = true OR (? AND purchases.user_id = ?)',
LOWEST_VOTE,
!user.id.nil?,
(if user.id.nil? then -1 else user.id end)


This is semantically equivalent to both, but the AND in the third clause prevents it from having an effect when there is no user.id.