TODO: update this to use arel (`where(arel_table[:path].not_eq(nil))`) to prevent issues with column collisions.