lib/active_support/dependencies.rb in activesupport-4.1.0.beta2 vs lib/active_support/dependencies.rb in activesupport-4.1.0.rc1

- old
+ new

@@ -405,11 +405,12 @@ end nil end def load_once_path?(path) - # to_s works around a ruby1.9 issue where #starts_with?(Pathname) will always return false + # to_s works around a ruby1.9 issue where String#starts_with?(Pathname) + # will raise a TypeError: no implicit conversion of Pathname into String autoload_once_paths.any? { |base| path.starts_with? base.to_s } end # Attempt to autoload the provided module name by searching for a directory # matching the expected path suffix. If found, the module is created and @@ -662,9 +663,17 @@ normalized = const.to_s.sub(/\A::/, '') normalized.sub!(/\A(Object::)+/, '') constants = normalized.split('::') to_remove = constants.pop + + # Remove the file path from the loaded list. + file_path = search_for_file(const.underscore) + if file_path + expanded = File.expand_path(file_path) + expanded.sub!(/\.rb\z/, '') + self.loaded.delete(expanded) + end if constants.empty? parent = Object else # This method is robust to non-reachable constants.