diff options
author | Benjamin Fleischer <github@benjaminfleischer.com> | 2013-09-30 15:20:28 -0500 |
---|---|---|
committer | Benjamin Fleischer <github@benjaminfleischer.com> | 2013-09-30 19:57:03 -0500 |
commit | 0b0beb71d648efb417207502e142289ee77aa723 (patch) | |
tree | 948270a32a97ad2fe10d8b59145c9253c87635f1 /activesupport/lib | |
parent | 432ffdb0739426122e216e0f7199ebc16f15de7e (diff) | |
download | rails-0b0beb71d648efb417207502e142289ee77aa723.tar.gz rails-0b0beb71d648efb417207502e142289ee77aa723.tar.bz2 rails-0b0beb71d648efb417207502e142289ee77aa723.zip |
require_dependency should allow Pathname-like objects, not just String
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index fff4c776a9..565d933cb3 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -198,9 +198,11 @@ module ActiveSupport #:nodoc: Dependencies.require_or_load(file_name) end + # Files required this way can be reloaded in development mode def require_dependency(file_name, message = "No such file to load -- %s") + file_name = file_name.to_path if file_name.respond_to?(:to_path) unless file_name.is_a?(String) - raise ArgumentError, "the file name must be a String -- you passed #{file_name.inspect}" + raise ArgumentError, "the file name must either be a String or implement #to_path -- you passed #{file_name.inspect}" end Dependencies.depend_on(file_name, message) |