From 4965a754d5c9bfde332398c653e003c749e62cf9 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Tue, 14 Mar 2006 15:15:06 +0000 Subject: Catch FixtureClassNotFound when using instantiated fixtures on a fixture that has no ActiveRecord model [Rick Olson] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3866 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/fixtures.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 71a28f4712..0e5f992538 100755 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -223,8 +223,10 @@ class Fixtures < YAML::Omap if load_instances ActiveRecord::Base.silence do fixtures.each do |name, fixture| - if model = fixture.find - object.instance_variable_set "@#{name}", model + begin + object.instance_variable_set "@#{name}", fixture.find + rescue FixtureClassNotFound + nil end end end -- cgit v1.2.3