Mostly a Ruby 1.9 compatibility patch - in 1.9, Module#const_defined? accepts a 2nd parameter, a flag specifying whether ancestors will be included. E.g.
>> RUBY_VERSION
=> "1.8.6"
>> module Parent; FOO = 'bar'; end
>> module Child; include Parent; end
>> Child.const_defined?('FOO')
=> false
>> RUBY_VERSION
=> "1.9.0"
>> module Parent; FOO = 'bar'; end
>> module Child; include Parent; end
>> Child.const_defined?('FOO')
=> true
Rails redefines Module#const_missing so that it can autoload associations, but as a result Class#const_missing is also redefined (Class < Module anyway). I think the whole dependencies.rb is in need of a refactor anyway, but at least this patch assures Ruby 1.9 compatibility.
Oh, this fixes test failures in 1.9 like:
1) Error:
test_inspect(DurationTest):
ArgumentError: ActiveSupport is not missing constant Hash!
/foo/bar/rails_trunk/activesupport/lib/active_support/dependencies.rb:240:in `raise'
/foo/bar/rails_trunk/activesupport/lib/active_support/dependencies.rb:240:in `load_missing_constant'
/foo/bar/rails_trunk/activesupport/lib/active_support/dependencies.rb:453:in `const_missing'
/foo/bar/rails_trunk/activesupport/lib/active_support/dependencies.rb:476:in `rescue in const_missing'
/foo/bar/rails_trunk/activesupport/lib/active_support/dependencies.rb:473:in `const_missing'
/foo/bar/rails_trunk/activesupport/lib/active_support/duration.rb:57:in `inspect'
./test/core_ext/duration_test.rb:5:in `test_inspect'