Янв
26
2009

Marshal.load = undefined class/module

Иногда в development при cache_classes = false

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Marshal 
  class <<self
    def load_with_preload_class(str, &p)
      str.scan(/.o:.([w:]+)/).each{|matches|
        begin
          # by constantizing the class name,
          # it should trigger it to be autoloaded.
          matches.first.constantize
        rescue NameError
          # I guess that wasn't a class we found after all.
          # Nothing to see here, move along
        end
      }
      load_without_preload_class(str, &p)
    end
    alias_method_chain :load, :preload_class
  end
end
Опубликовал adik в Технотрония | Метки:

Один комментарий

  • Кирилл Максимов

    Спасибо, помогло!

    Комментарии | 22 августа 2009

RSS лента комментариев

Комментирование закрыто.

Работает на WordPress | Локализация: goodwin.wpbot.ru