`Project.all` here is not memory efficient
Created by: zenati
@limit_project_ids
is supposed here to contain an array of ids.
Project.pluck(:id)
is better than Project.all
because:
- :all will run a
select *
and initializen
activerecord objects in memory, wheren
is the count of all projects. It's not memory efficient. - :all returns an activerelation, but here we only need an array of ids
- :pluck returns what's needed without initializing objects.