diff options
author | Xavier Noria <fxn@hashref.com> | 2012-06-10 00:35:18 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2012-06-10 00:38:40 +0200 |
commit | d3a99c32d172a30709fd45506e120c335cb3d929 (patch) | |
tree | 1afdacf3a416702fd50fa168bcdb105d5343ffe4 /activesupport | |
parent | 6bd729e86f4ead25fe614a76aa652425f1d73942 (diff) | |
download | rails-d3a99c32d172a30709fd45506e120c335cb3d929.tar.gz rails-d3a99c32d172a30709fd45506e120c335cb3d929.tar.bz2 rails-d3a99c32d172a30709fd45506e120c335cb3d929.zip |
removes the obsolete require_association method from dependencies
This is an obsolete method from the very early days,
apparently it was used circa 2004 because STI support
was not smart enough. This method is not public
interface, and we are heading a major version, so
removal seems right.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/CHANGELOG.md | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 22 | ||||
-rw-r--r-- | activesupport/test/dependencies_test.rb | 4 |
3 files changed, 7 insertions, 21 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index c778647ea5..804336da91 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,5 +1,7 @@ ## Rails 4.0.0 (unreleased) ## +* Remove obsolete and unused `require_association` method from dependencies. *fxn* + * Add `:instance_accessor` option for `config_accessor`. class User diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 66f3af7002..5db06e0a56 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -168,8 +168,6 @@ module ActiveSupport #:nodoc: end end - # Use const_missing to autoload associations so we don't have to - # require_association when using single-table inheritance. def const_missing(const_name, nesting = nil) klass_name = name.presence || "Object" @@ -220,11 +218,7 @@ module ActiveSupport #:nodoc: raise ArgumentError, "the file name must be a String -- you passed #{file_name.inspect}" end - Dependencies.depend_on(file_name, false, message) - end - - def require_association(file_name) - Dependencies.associate_with(file_name) + Dependencies.depend_on(file_name, message) end def load_dependency(file) @@ -306,20 +300,14 @@ module ActiveSupport #:nodoc: mechanism == :load end - def depend_on(file_name, swallow_load_errors = false, message = "No such file to load -- %s.rb") + def depend_on(file_name, message = "No such file to load -- %s.rb") path = search_for_file(file_name) require_or_load(path || file_name) rescue LoadError => load_error - unless swallow_load_errors - if file_name = load_error.message[/ -- (.*?)(\.rb)?$/, 1] - raise LoadError.new(message % file_name).copy_blame!(load_error) - end - raise + if file_name = load_error.message[/ -- (.*?)(\.rb)?$/, 1] + raise LoadError.new(message % file_name).copy_blame!(load_error) end - end - - def associate_with(file_name) - depend_on(file_name, true) + raise end def clear diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index 081e6a16fd..f622c6b43f 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -60,10 +60,6 @@ class DependenciesTest < ActiveSupport::TestCase assert_raise(MissingSourceFile) { require_dependency("missing_service") } end - def test_missing_association_raises_nothing - assert_nothing_raised { require_association("missing_model") } - end - def test_dependency_which_raises_exception_isnt_added_to_loaded_set with_loading do filename = 'dependencies/raises_exception' |