aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/CHANGELOG2
-rwxr-xr-xactiverecord/lib/active_record/fixtures.rb6
-rwxr-xr-xactiverecord/test/fixtures_test.rb2
3 files changed, 7 insertions, 3 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index ab441ac9e3..00b207bb38 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Catch FixtureClassNotFound when using instantiated fixtures on a fixture that has no ActiveRecord model [Rick Olson]
+
* Allow ordering of calculated results and/or grouped fields in calculations [solo@gatelys.com]
* Dynamically set allow_concurrency. #4044 [Stefan Kaes]
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
diff --git a/activerecord/test/fixtures_test.rb b/activerecord/test/fixtures_test.rb
index b1da54b43f..88f01c8a05 100755
--- a/activerecord/test/fixtures_test.rb
+++ b/activerecord/test/fixtures_test.rb
@@ -11,7 +11,7 @@ class FixturesTest < Test::Unit::TestCase
self.use_instantiated_fixtures = true
self.use_transactional_fixtures = false
- fixtures :topics, :developers, :accounts, :tasks, :categories
+ fixtures :topics, :developers, :accounts, :tasks, :categories, :funny_jokes
FIXTURES = %w( accounts companies customers
developers developers_projects entrants