I have an application that needs to support a small set of trusted users uploading new templates. I’ll store them in the database or in S3. My question is: how do I tell the controller to render a given template? Of course, I could do it with a manual ERB call:
class MyController < ApplicationController
def foo
template_source = find_template(params[:name])
template = Erubis::Eruby.new(template_source)
render :text => template.result({ :some => @data })
end
end
But then I lose things like helpers and the automatic copying of instance variables.
You could do it using render :inline