Sha256: 9255f9bcf6baf5b2e09c49c888a7da3dbf07ebdfac504a508902fe43e345a0ce

Contents?: true

Size: 576 Bytes

Versions: 15

Compression:

Stored size: 576 Bytes

Contents

# Shamelessly swiped from: http://pastie.org/720905
# Initial implementation from: http://kballcodes.com/2009/09/05/rails-memcached-a-better-solution-to-the-undefined-classmodule-problem/
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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
lawnchair-0.6.11 lib/marshal_extension.rb
lawnchair-0.6.10 lib/marshal_extension.rb
lawnchair-0.6.9 lib/marshal_extension.rb
lawnchair-0.6.8 lib/marshal_extension.rb
lawnchair-0.6.7 lib/marshal_extension.rb
lawnchair-0.6.6 lib/marshal_extension.rb
lawnchair-0.6.5 lib/marshal_extension.rb
lawnchair-0.6.4 lib/marshal_extension.rb
lawnchair-0.6.2 lib/marshal_extension.rb
lawnchair-0.6.0 lib/marshal_extension.rb
lawnchair-0.5.7 lib/marshal_extension.rb
lawnchair-0.5.6 lib/marshal_extension.rb
lawnchair-0.5.5 lib/marshal_extension.rb
lawnchair-0.5.4 lib/marshal_extension.rb
lawnchair-0.5.2 lib/marshal_extension.rb