[Rails] Re: Renderer: rendering to *another* format inside a renderer
On Saturday 03 July 2010, Marnen Laibow-Koser wrote:
> Michael Schuerig wrote:
> > My skeletal renderer looks like this
> >
> > ActionController.add_renderer :pdf do |template, options|
> >
> > html = render_to_string(template, options)
> > ...
> >
> > end
> >
> > The trouble here is that render_to_string looks for a template for
> > MIME type PDF, e.g. show.pdf.erb. Unfortunately, that's not what I
> > want. I need to get HTML.
>
> WTF? What problem are you trying to solve that means you need to
> serve HTML when a PDF file is requested? I don't see how that can
> ever be the right thing to do.
I'm passing the HTML into an HTML-to-PDF converter. wkhtmltopdf in my
case. wicked_pdf does the same, but it works by alias_chain-ing render,
which I'd like to avoid. Instead, I'm defining a renderer. See
http://www.engineyard.com/blog/2010/render-options-in-rails-3/
Michael
--
Michael Schuerig
mailto:michael@schuerig.de
http://www.schuerig.de/michael/
--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home