I've "always" known about Ruby's compact method to get rid of nil values. # Enumerable.compact [1, "a", nil, " ", [], {}].compact => [1, "a", " ", [], {}] However, I just learned that as of Rails 6.1 there has been a compact_blank method to get rid of those items that would respond true to blank?