Displaying 1 result from an estimated 1 matches for "render_erb".
2010 Oct 20
7
How can I render a template outside of a controller in Rails 3?
...9;ve done has been helpful, and I eventually found
some useful info at
http://www.swombat.com/rails-rendering-templates-outside-of-a-contro.
However, this seems to be broken in Rails 3. Does anyone have any ideas how
I can fix this method or perhaps know of a better approach?
My method:
def render_erb(template_path, params)
view = ActionView::Base.new(ActionController::Base.view_paths, {})
class << view
include ApplicationHelper
end
view.render(:file => "#{template_path}.html.erb", :locals => params)
end
The error:
ActionVi...