aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorTobias Lütke <tobias.luetke@gmail.com>2006-01-25 02:40:25 +0000
committerTobias Lütke <tobias.luetke@gmail.com>2006-01-25 02:40:25 +0000
commit2dc16df10c830abb68e952ae93059f8dc7cabdb1 (patch)
tree90de97ffd6eee03c4a71989b64bc8830ce516c21 /activerecord
parent9c52a41241a632315edb77381240b66a7cc5aef4 (diff)
downloadrails-2dc16df10c830abb68e952ae93059f8dc7cabdb1.tar.gz
rails-2dc16df10c830abb68e952ae93059f8dc7cabdb1.tar.bz2
rails-2dc16df10c830abb68e952ae93059f8dc7cabdb1.zip
give helpful error messages when fixtures accessed style table_name(:name) cannot be found [Tobias Luetke]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3480 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rwxr-xr-xactiverecord/lib/active_record/fixtures.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb
index 2c3609aa77..3d2fa3ac71 100755
--- a/activerecord/lib/active_record/fixtures.rb
+++ b/activerecord/lib/active_record/fixtures.rb
@@ -453,7 +453,11 @@ module Test #:nodoc:
force_reload = optionals.shift
@fixture_cache[table_name] ||= Hash.new
@fixture_cache[table_name][fixture] = nil if force_reload
- @fixture_cache[table_name][fixture] ||= @loaded_fixtures[table_name][fixture.to_s].find
+ if @loaded_fixtures[table_name][fixture.to_s]
+ @fixture_cache[table_name][fixture] ||= @loaded_fixtures[table_name][fixture.to_s].find
+ else
+ raise StandardError, "No fixture with name '#{fixture}' found for table '#{table_name}'"
+ end
end
end
end