Skip to content

Instantly share code, notes, and snippets.

@sarcilav
Created September 20, 2011 21:54
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save sarcilav/1230528 to your computer and use it in GitHub Desktop.
def pdf_url(url)
"http://pdfmyurl.com/?url=#{url}"
end
link_to( "Download PDF", pdf_url(some_url(with_some_params))
@nhocki
Copy link

nhocki commented Sep 21, 2011

I would probably have also created this helper

 def pdf_url_for(object)
    pdf_url(url_for(object))
 end

I'm really lazy, I know!
And then just have pdf_url_for(@user)

@rderoldan1
Copy link

I found a better solution, I gess..

using gem pdf-my-url

then just use
<%= pdf_my_url 'CBC', 'http://www.cbc.ca/' %>
<%= pdf_my_url 'CBC', 'http://www.cbc.ca/', :filename => 'CBC.pdf' %>

https://github.com/ksylvest/pdf-my-url/wiki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment