问题
I'm trying to use require_dependency
from ActiveSupport
library in pry:
require 'active_support' #=> true
require_dependency 'test' #=> NoMethodError: undefined method
#=> `require_dependency' for main:Object
What could be the problem?
回答1:
ActiveSupport used to be pretty evil by loading a ton of stuff on require. The "kitchen sink" approach opened a lot of core classes up and changed their behavior (like JSON). This caused incompatibilities/problems with other gems and code that expected core ruby functions to behave like their vanilla selves.
So now requiring just active_support does not load anything.
see http://edgeguides.rubyonrails.org/active_support_core_extensions.html
in your case you probably will need require 'active_support/core_ext'
来源:https://stackoverflow.com/questions/11021955/cant-load-require-dependency