Retrieve only values with .select method

Hi Folks,

I have a model called Interview. I want retrieve from the model database
a list (maybe is much better say array) with some fields. Exactly I
want the column values from the attribute :created_at in an array. I
used @interview.select(:created_at) but I have an array with the
attributes

=> [#<Interwiew created_at: "2013-11-20 17:14:23">, #<Interwiew
created_at: "2013-11-20 19:08:30">, #<Interwiew created_at: "2013-11-20
20:56:31">, #<Interwiew created_at: "2013-11-20 20:56:43">, #<Interwiew
created_at: "2013-11-20 20:57:03">]

instead I want an array with only the values

=> [2013-11-20 17:14:23, 2013-11-20 19:08:30, 2013-11-20 20:56:31,
2013-11-20 20:56:43, 2013-11-20 20:57:03]

I hope my question is clear and thank you in advance

A

Hello men

U can use method pluck

@interviews.pluck(:created_at)

select return array relations

man

thanks a lot m*n :slight_smile:

C