That may instantiate a big array isn't it ? Anyway this could be rewritten as :

    @projects.reject!{ |p| !visible_ids.include?(p.id.to_s) }

(e.g. we reject the project if not in visible ids)

which turns out to be equivalent with :

    @projects.select!{ |p| p.id.to_s.in?(visible_ids) }

Please validate the logic before changing this. And don't forget to remove the `to_s` if you add the `to_i` as I  suggested above