On Mar 18, 3:04 am, Michael Pavling <pavl...@gmail.com> wrote: > > In the end, I wrote some wholly ugly code to get around > it:http://www.workingwithrails.com/forums/4-ask-a-rails-expert/topics/80...http://groups.google.com/group/prawn-ruby/browse_thread/thread/185977... > > ... my solution was certainly frowned on by the Prawn core; and > they're correct. It does seem thatPrawntocauses more problems than > it solves by trying to be "nice". If you follow the Prawn guides for > integrating with Rails, the process is a lot more re-useable. > > But if you're in my position, and are stuck with loads ofPrawnto > views you can't get rid of overnight, then the solution I've posted > will at least let you take their output and put it to different use.
Thanks for the reply. I ended up not needing to do what you did since I'm not needing to call #render_to_string from a model. However, the discussions and stuff you mentioned and included in your links gave me the answer that now works for my case. I was calling #render_to_string as follows: document = render_to_string :action => "print", :layout => false This didn't work because the print action had other, non prawnto templates in its template directory, specifically an RJS template. Since the action that contained the above line of code was always being called via AJAX and request.rjs? was always true, my request to render "print" as a string would always render my print.rjs template. Reading your posted threads, I got the idea to try: document = render_to_string :template => "worksheets/ print.pdf.prawn", :layout => false This works perfectly for me and my simple case. So, once again, thank! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.