Skip to content

Instantly share code, notes, and snippets.

@biilmann
Created September 21, 2012 22:21
Show Gist options
  • Save biilmann/3764279 to your computer and use it in GitHub Desktop.
Save biilmann/3764279 to your computer and use it in GitHub Desktop.
Fix for thread safety issue with ERB
# Monkey patch to make ERB stop using the global TOPLEVEL_BINDING
ERB.class_eval do
def result(b=binding)
if @safe_level
proc {
$SAFE = @safe_level
eval(@src, b, (@filename || '(erb)'), 0)
}.call
else
eval(@src, b, (@filename || '(erb)'), 0)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment