On Dec 20, 2010, at 4:30 PM, TomRossi7 wrote:
> Is there a way to write a csv file using a hash instead of an array?
> Something like this:
>
> header_keys = :first_name, :last_name, :email
> FasterCSV.open("path/to/file.csv", "w") do |csv|
> User.all.do |user|
> csv << user
csv << user.attributes.values_at(*header_keys)> end
> end
>
> Thanks...
>
> --
> You received this message because you are subscribed to the Google
> Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-
> talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> .
> For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
> .
>
Rob Biedenharn
Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org
http://AgileConsultingLLC.com/
rab-/VpnD74mH8+00s0LW7PaslaTQe2KTcn/@public.gmane.org
http://GaslightSoftware.com/
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.