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. I haven't found a straightforward option to achieve this.
html = render_to_string(options.merge( :template => "#{template}.html")
That's not pretty, but gets me halfway there. However, when I call
render :pdf => 'show', :layout => 'print'
the layout is passed through to render_to_string, but ignored. If I rename layouts/print.html.erb to layouts/print.pdf.erb, it works as long as all partials used by that layout are available in pdf variants, too.
Now, I see that this behavior might be useful most of the time, but this time it is exactly not what I want. Is there a *clean* way to make render_to_string do what I want?
Michael