Last Updated: February 25, 2016
·
867
· notgrm

ActiveRecord get all ids

To speed up my development I use Populator gem. For a belongs_to relationship I need to get all the ids from my model. I use this tip

Object.pluck(:id)

This method is designed to perform select by a single column

API Ruby on Rails