我尝试在pry中使用ActiveSupport库中的require_dependency:
require 'active_support' #=> true
require_dependency 'test' #=> NoMethodError: undefined method
#=> `require_dependency' for main:Object可能的问题是什么?
发布于 2012-06-14 04:15:52
ActiveSupport曾经是非常邪恶的,它在需要的时候加载大量的东西。“厨房水槽”方法打开了许多核心类,并改变了它们的行为(如JSON)。这导致了与其他gem和代码的不兼容/问题,这些gem和代码期望核心ruby函数的行为像它们自己一样。
所以现在只需要active_support并不能加载任何东西。
请参阅http://edgeguides.rubyonrails.org/active_support_core_extensions.html
在您的情况下,您可能需要require 'active_support/core_ext'
https://stackoverflow.com/questions/11021955
复制相似问题