Class: Marshal

Inherits:
Object
  • Object
show all
Defined in:
lib/marshal_extension.rb

Overview

Class Method Summary collapse

Class Method Details

.load_with_rails_classloader(*args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/marshal_extension.rb', line 4

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