I'm trying to figure out how to convert a Rails plugin I wrote that handles a custom PDF render that works in Rails 2.3.9 but doesn't in Rails 3.1. What we have is a separate server that actually does the PDF generation of the webpage and then sends this back to the Rails app. The plugin is located at https://github.com/amkirwan/too_rendermonkey. I understand in Rails 3 alias_method_chain is gone and I should use ActionController::Renderers.add. I've looked at the example at but I can't seem to get it to work http://www.engineyard.com/blog/2010/render-options-in-rails-3/. If I do something like the following:
module TooRendermonkey def self.run ActionController::Renderers.add :pdf do |pdf, options| _render_option_pdf(options) end end
def _render_option_pdf(options) .... end
end
I can see from the console that the :pdf is registered but it never gets called from the Rails app as far as I can tell.
ActionController::Renderers.class_eval do self.const_get(:RENDERERS)[:pdf].call end
Any help would be appreciated.