Skip to content

Instantly share code, notes, and snippets.

@rmascarenhas
Created September 26, 2012 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmascarenhas/3790807 to your computer and use it in GitHub Desktop.
Save rmascarenhas/3790807 to your computer and use it in GitHub Desktop.
EmailRenderer
require 'config/environment'
class EmailRenderer
class_inheritable_accessor :view_paths
self.view_paths = ["."]
def template
@template ||= initialize_template
end
def render
template.render :file => 'foo.html.erb'
end
private
def initialize_template
template = ActionView::Base.new(self.class.view_paths, { :user => 'User' }, self)
template.template_format = :html
template
end
end
puts EmailRenderer.new.render
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment