Login
Roast topics
Find topics
Find it!
From:
Boring Rails: Skip the bullshit and ship fast |
(Uncensored)
subscribe
Pluck single values out of ActiveRecord models or Enumerables
https://boringrails.com/tips/rails-pluck-single-values
links
backlinks
Tagged with:
ruby
rails
Roast topics
Find topics
Roast it!
Rails has a great, expressive term called pluck that allows you to grab a subset of data from a record. You can use this on ActiveRecord models to return one (or a few) columns.