aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-03-17 21:48:28 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-03-17 21:48:28 +0000
commitfbf41c72a930a1b879452d137ba3d75d5ceaf358 (patch)
tree5a7fb0aaaac82854ff68feb7412e48c080397165 /activerecord/lib/active_record
parentd07d6e900c1919bfafd4e2382b31cfe0faeebaa0 (diff)
downloadrails-fbf41c72a930a1b879452d137ba3d75d5ceaf358.tar.gz
rails-fbf41c72a930a1b879452d137ba3d75d5ceaf358.tar.bz2
rails-fbf41c72a930a1b879452d137ba3d75d5ceaf358.zip
Added logging for dependency load errors with fixtures (closes #11056) [stuthulhu]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9050 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-xactiverecord/lib/active_record/fixtures.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb
index c5b90efb4b..a68086bf66 100755
--- a/activerecord/lib/active_record/fixtures.rb
+++ b/activerecord/lib/active_record/fixtures.rb
@@ -846,15 +846,21 @@ module Test #:nodoc:
setup_fixture_accessors(table_names)
end
+ def try_to_load_dependency(file_name)
+ require_dependency file_name
+ rescue LoadError => e
+ # Let's hope the developer has included it himself
+
+ # Let's warn in case this is a subdependency, otherwise
+ # subdependency error messages are totally cryptic
+ ActiveRecord::Base.logger.warn("Unable to load #{file_name}, underlying cause #{e.message} \n\n #{e.backtrace.join("\n")}")
+ end
+
def require_fixture_classes(table_names = nil)
(table_names || fixture_table_names).each do |table_name|
file_name = table_name.to_s
file_name = file_name.singularize if ActiveRecord::Base.pluralize_table_names
- begin
- require_dependency file_name
- rescue LoadError
- # Let's hope the developer has included it himself
- end
+ try_to_load_dependency(file_name)
end
end