Skip to content

Commit

Permalink
Catch FixtureClassNotFound when using instantiated fixtures on a fixt…
Browse files Browse the repository at this point in the history
…ure that has no ActiveRecord model [Rick Olson]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3866 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
technoweenie committed Mar 14, 2006
1 parent 796a43d commit 4965a75
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions 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]
Expand Down
6 changes: 4 additions & 2 deletions activerecord/lib/active_record/fixtures.rb
Expand Up @@ -223,8 +223,10 @@ def self.instantiate_fixtures(object, table_name, fixtures, load_instances=true)
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
Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/fixtures_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit 4965a75

Please sign in to comment.