Here are two sample codes.
First one with collect
:
User.first.gifts.collect(&:id)
Second one with pluck
:
User.first.gifts.pluck(:id)
Is there any difference between them in performance or something else?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…