Render ERB templates via script/runner

Is there an approved, easy way to generate files via erb templates
through script/runner?

I need to generate a set of html files offline (via a cron job). I
would like to use script/runner and use an erb template with various
helpers and partials that I’ve already written.

Googling yields one suggestion: (
http://www.swombat.com/rails-rendering-templates-outside-of-a-contro
) which is essentially:

def render_erb(template_path, params)
view = ActionView::Base.new(ActionController::Base.view_paths,
{})

class << view
 include EmailHelper, ApplicationHelper, WhateverHelper
end

view.render(:file => "#{template_path}.html.erb", :locals =>

params)
end

But… this only works in simple cases and even then fails when called
via script/runner with nil.content_type errors.

Looking at how ActionMailer does its work it seems that there are a
whole lot of hoops that are being jumped through to stub out
ActionController expectations…

So the question is, has anyone done this work already? Perhaps
distilled ActionMailer’s strategy’s for use outside of the mailing
context?

Thanks for any ideas,

John Devine

bump…?