How to use rails routes in external classes?

Posted by wesgarrison on Stack Overflow See other posts from Stack Overflow or by wesgarrison
Published on 2010-05-27T15:37:55Z Indexed on 2010/05/27 15:41 UTC
Read the original article Hit count: 227

Filed under:
|
|
|

I'm using prawn to generate pdfs, set up ala http://wiki.github.com/sandal/prawn/using-prawn-in-rails

I'd like to access my routes so I can generate links in my pdfs, but now I'm not in a template like I used to do with prawnto, so I don't have access to the named routes.

class MyPdf < Prawn::Document
  def to_pdf
    text root_path
  end
end

How can I include my named routes?

© Stack Overflow or respective owner

Related posts about pdf

Related posts about url-routing