New to ROR

I’d use something like prawn-rails to write your pdf generation code as a view. As would any other view your controller would setup any data you need and then the view file itself contains the layout info.

You could even use the usual respond_to stuff so that going to the url with .html at the end gets you the html version but changing the suffix to .pdf would get you the pdf version.