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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/99a89031a0a8dfba1694c7438d552fa0%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
Hello men U can use method pluck @interviews.pluck(:created_at) select return array relations 2013/11/27 Cluter Vipic <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>> 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 > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/99a89031a0a8dfba1694c7438d552fa0%40ruby-forum.com > . > For more options, visit https://groups.google.com/groups/opt_out. >-- att, Rogerio A complicação se descomplica na mesma proporção que fazemos os nós se desatarem ao tecer o conhecimento do saber. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACxYeUofqSLi-zt5yv_Qm_gmNtSaWGp2EE9%3DVUnYT7cD--HDjA%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
man 2013/11/27 Rogerio Medeiros <argerim-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> Hello men > > U can use method pluck > > @interviews.pluck(:created_at) > > select return array relations > > > > > 2013/11/27 Cluter Vipic <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > >> 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 >> >> -- >> Posted via http://www.ruby-forum.com/. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/rubyonrails-talk/99a89031a0a8dfba1694c7438d552fa0%40ruby-forum.com >> . >> For more options, visit https://groups.google.com/groups/opt_out. >> > > > > -- > att, > > Rogerio > > A complicação se descomplica na mesma proporção que fazemos os nós se > desatarem ao tecer o conhecimento do saber. >-- att, Rogerio A complicação se descomplica na mesma proporção que fazemos os nós se desatarem ao tecer o conhecimento do saber. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACxYeUq5DNJDPXN7BfZHRcPnTHxQAEeEd%3DeycxQmiiKJN1NjsQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
thanks a lot m*n :) C -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9536b0249f9c37cff0161d484b717431%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.