I use the following code to render a template to a string that I can use later on:
renderer = ActionView::Base.new(MyApp::Application.config.view_path)
# INCLUDE HELPERS HERE
data = renderer.render(:partial => template, :locals => locals)
However, I want to be able to access some helpers (actually all). In rails 2.3 I was able to do this:
renderer.extend ApplicationController.master_helper_module
However, as of Rails 3, this no longer works. So, how do I make my helper methods available to use in my template?
You may want to look at
abstract_controller/rendering.rbIt looks like in rails 3 we should be able to do something like this:And the module
master_helper_moduleis now accessed by name_helpers, and it should be already included inview_context_class