Topic: PDF Attachments

Given this link :

<%= link_to "View PDF", agreement_path(:id => request, :format => "pdf") %>

How would I link to the same within an email?

Last edited by CharlieB123 (2012-04-17 12:33:56)

Re: PDF Attachments

First,  you'd just have to go into whatever controller action agreement_path calls,  and see where the actual file is that's getting sent back,  say it's in public/a.pdf ,  then in a mailer:

  def send_a_pdf
    attachments['a.pdf'] = File.read('public/a.pdf')
    mail(:to=>'customer@theirco.com',:from=>'someone@yourco.com',:subject=>"Here's your PDF")    
  end

This assumes your on Rails 3

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.