Skip to content

Instantly share code, notes, and snippets.

@sumskyi
Created March 9, 2011 15:16
Show Gist options
  • Save sumskyi/862367 to your computer and use it in GitHub Desktop.
Save sumskyi/862367 to your computer and use it in GitHub Desktop.
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