Re: New to ROR

15 views
Skip to first unread message

Frederick Cheung

unread,
Jul 19, 2012, 6:04:40 AM7/19/12
to rubyonra...@googlegroups.com


On Wednesday, July 18, 2012 12:56:29 PM UTC+1, Wijnand wrote:
This is my first week of Ruby and ROR and new to this discussiongroup.

I build a pdf generator with prawn. Currently I run it from a run.rb file that contains:
[snip]
Now I have no idea, how  to execute that file when I press on my generate button in my rails app:

My apologies if this is the wrong place to ask my question, but I have been lost at this for 2 days now and I don't know how to find the answer on Google :/ 

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.

Fred 
Reply all
Reply to author
Forward
0 new messages