title: Rails 3 -Render PDF from view and attach to email
body: <p>I have been using Wicked_pdf to render a view as a PDF and actionmailer to send emails, but I can't get them to work together. I want to attach a PDF version of a certain view to an email using actionmailer and send it out by clicking a link or a button. I have a link_to command that sends out an email. Here is my controller that gets the email generated:  </p>
  
  <pre><code>def sendemail
   @user = User.find(params[:id])
   Sendpdf.send_report(@user).deliver
   redirect_to user_path(@user)
   flash[:notice] = 'Email has been sent!'
  end  
  </code></pre>
  
  <p>Here is what I have in my actionmailer:  </p>
  
  <pre><code>class Sendpdf &lt; ActionMailer::Base
  default :from =&gt; "myemail@email.com"
  
  def send_report(user)
  @user = user
    attachment "application/pdf" do |a|
    a.body = #Something should go here, maybe WickedPDF.new.something?
    a.filename = 'MyPDF'
  end     
  mail(:to =&gt; user.email, :subject =&gt; "awesome pdf, check it")
  end
  
  end
  </code></pre>
  
  <p>I have seen many questions and answers, most dealing with Prawn. It seems like there should be a simple answer to this. Can anyone help?</p>
  
  <p><strong>UPDATE</strong> I'm grateful for a suggestion to use as an alternative option in the answer below. However, I would really like to learn how to render a view as a PDF and attach it to my email. I am open to using something different like Prawn or anything else if I need to.</p>