Created
March 10, 2011 10:05
-
-
Save fushang318/863860 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class << Marshal | |
def load_with_rails_classloader(*args) | |
begin | |
load_without_rails_classloader(*args) | |
rescue ArgumentError, NameError => e | |
if e.message =~ %r(undefined class/module) | |
const = e.message.split(' ').last | |
const.constantize | |
retry | |
else | |
raise(e) | |
end | |
end | |
end | |
alias_method_chain :load, :rails_classloader | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment