Skip to content

Instantly share code, notes, and snippets.

@trushkevich
Created October 22, 2014 21:27
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 trushkevich/ab9546813709b0f9dafc to your computer and use it in GitHub Desktop.
Save trushkevich/ab9546813709b0f9dafc to your computer and use it in GitHub Desktop.
module Renderable
def renderer
return @renderer if @renderer
@renderer = ActionView::Base.new(Rails.configuration.paths["app/views"])
@renderer.class_eval do
include Rails.application.routes.url_helpers
include ApplicationHelper
define_method :default_url_options, -> { Rails.application.config.action_mailer.default_url_options }
def protect_against_forgery?
false
end
end
@renderer
end
end
@trushkevich
Copy link
Author

render anything anywhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment