A little bit more neat solution:
Product.where(:colour => 'blue').pluck(:id)
In recent versions of Rails the ids
method can be used.
Product.where(color: 'blue').ids
A little bit more neat solution:
Product.where(:colour => 'blue').pluck(:id)
In recent versions of Rails the ids
method can be used.
Product.where(color: 'blue').ids