From: Alexey Petrushin Date: 2008-11-16T05:44:29+09:00 Subject: How to force 'const_missing' in 'YAML.load'? Hello! Is there a way to force 'const_missing' exception in 'YAML.load' if the Class definition is not found? By default if it can't find the class definition it just silently instantiates the YAML::Object stub. One solution is to add the Class to Domain Types. But for my situation this is absolutely not suitable. YAML.add_domain_type("TheClass,2007", "") do |type, val| klass = eval(type.split(':').last) YAML.object_maker(klass, val) end class TheClass def to_yaml_type "!TheClass,2007/#{self.class}" end end Other - alter 'Module' in 'yaml/tag.rb' class Module # ... def yaml_tag_read_class( name ) eval(name, TOPLEVEL_BINDING) << ADD THIS LINE name end end If i alter 'Module' in 'yaml/tag.rb' it works, but if i override it in another place it doesn't. Why?! -- Posted via http://www.ruby-forum.com/.