http://pastie.org/863834 The "a.body" appears to want a string, which is why I tried render_to_string as shown in the code linked above. This doesn''t work, I get "undefined method for render_to_string". I basically need to attach a PDF that is generated in another controller, passing ''data'' as parameters for which the PDF generating engine will use. I am able to otherwise send e-mails with ActionMailer, and generate this PDF. I just can''t attach the PDF to the e-mail. The API says it wants: a.body = generate_your_pdf_here() How to do I replace the "generate_your_pdf_here()" with what is produced by the action ''print_pdf'' in the ''report'' controller? Any clues? Thanks in advance! -- 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-/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.
Hey, here''s an example, def mailer_method(mymodel) content_type "multipart/alternative" part :content_type => "text/html", :body => mymodel.text attachment "application/pdf" do |a| a.filename = mymodel.pdf_filename a.body = mymodel.pdf_render.render end Take a look on the "content_type" header, you have to set the mail as a Multipart email, not just html. Regards, Fernando -- 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-/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.
This definitely helps, thank you, but I still am unsure how to pass the parameters to the mymodel.pdf_render action? The only way I know of to pass parameters is as if it were a URL, such as with: /mymodel/pdf_render?data=BLAH or something like: :controller => ''mymodel'', :action => ''pdf_render'', :data => "BLAH" How could I achieve this using the syntax you gave me?> a.body = mymodel.pdf_render.renderSorry for my newbieness, THANKS! -- 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-/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.
I think I got it, thanks for your help!!! -- 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-/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.