class ActionController::Parameters

def compact_blank

Uses Object#blank? for determining if a value is blank.
Returns a new ActionController::Parameters instance without the blank values.
def compact_blank
  reject { |_k, v| v.blank? }
end