lib/active_support/inflector/methods.rb in activesupport-5.0.1 vs lib/active_support/inflector/methods.rb in activesupport-5.0.2.rc1
- old
+ new
@@ -271,10 +271,10 @@
next candidate if constant.const_defined?(name, false)
next candidate unless Object.const_defined?(name)
# Go down the ancestors to check if it is owned directly. The check
# stops when we reach Object or the end of ancestors tree.
- constant = constant.ancestors.inject do |const, ancestor|
+ constant = constant.ancestors.inject(constant) do |const, ancestor|
break const if ancestor == Object
break ancestor if ancestor.const_defined?(name, false)
const
end