From 37a298b04350425b1055b7bead8560c3d5e7331d Mon Sep 17 00:00:00 2001 From: Fumiaki MATSUSHIMA Date: Mon, 28 Mar 2016 23:04:36 +0900 Subject: Fix marshal with autoloading for nested class/module #24150 break autoloading for nested class/module. There is test for nested class but it doesn't work correctly. Following code will autoload `ClassFolder::ClassFolderSubclass` before `Marshal.load`: `assert_kind_of ClassFolder::ClassFolderSubclass, Marshal.load(dumped)` --- activesupport/lib/active_support/core_ext/marshal.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/marshal.rb b/activesupport/lib/active_support/core_ext/marshal.rb index ca278cb2fa..5875ae5f71 100644 --- a/activesupport/lib/active_support/core_ext/marshal.rb +++ b/activesupport/lib/active_support/core_ext/marshal.rb @@ -3,7 +3,7 @@ module ActiveSupport def load(source) super(source) rescue ArgumentError, NameError => exc - if exc.message.match(%r|undefined class/module (.+)|) + if exc.message.match(%r|undefined class/module (.+?)(::)?\z|) # try loading the class/module loaded = $1.constantize -- cgit v1.2.3