Rails Active Record - Get ids array from relation
Have been reading through the rails 4 docs and it looks like they support the ids
method that I said would be cool in the question now.
http://api.rubyonrails.org/classes/ActiveRecord/Calculations.html#method-i-ids
Nice to know the team are reading my mind :)
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