I am trying to take a csv string output and send it as a file
attachment, but keep my data is only coming out as gobbly gook. The csv
string is valid going into the mailer action.
Valid CSV
id,name,dealer_code,created_at,quantity,total_quote,shipping_cost
1000012,Testing project,,Thu Apr 09 16:31:08 UTC 2009,0,0,0.0
1000013,test,,Thu Apr 09 16:35:19 UTC 2009,0,0,0.0
In Action Mailer, I have:
def report(csv, name)
.
.
.
body :name => name
attachment "text/csv; charset=utf-8" do |a|
a.body = csv
a.filename = name
end
end
unfortunately, this gives me:
--mimepart_49de4abf9b848_6d414263a4194
Content-Type: text/csv; name="New projects"
Content-Transfer-Encoding: Base64
Content-Disposition: attachment; filename="New projects"
aWQsbmFtZSxkZWFsZXJfY29kZSxjcmVhdGVkX2F0LHF1YW50aXR5LHRvdGFs
X3F1b3RlLHNoaXBwaW5nX2Nvc3QKMTAwMDAxMixUZXN0aW5nIHByb2plY3Qs
LFRodSBBcHIgMDkgMTY6MzE6MDggVVRDIDIwMDksMCwwLDAuMAoxMDAwMDEz
LHRlc3QsLFRodSBBcHIgMDkgMTY6MzU6MTkgVVRDIDIwMDksMCwwLDAuMAo--
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 post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@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
-~----------~----~----~----~------~----~------~--~---