Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4622

What is the difference between pluck and collect in Rails?

$
0
0

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?


Viewing all articles
Browse latest Browse all 4622


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>