Rails: how do I use a template from somewhere other than the file system? -
i have application needs support small set of trusted users uploading new templates. i'll store them in database or in s3. question is: how tell controller render given template? of course, 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 lose things helpers , automatic copying of instance variables.
you using render :inline
render :inline => find_template(params[:name])
Comments
Post a Comment