Pavel
Pavel

Reputation: 1974

ActiveRecord::Associations::Collection to Array

I have a collection:

<Vote id: nil, author_uid: 9326214>,
<Vote id: nil, author_uid: 5643421>,
<Vote id: nil, author_uid: 9753813>

How can I get an array of author_uid values?

Thanks!

Upvotes: 2

Views: 955

Answers (1)

nTraum
nTraum

Reputation: 1426

Vote.all.pluck(:author_uid)

Ruby on Rails Guide - pluck

Upvotes: 6

Related Questions