提交 4965a754 编写于 作者: R Rick Olson

Catch FixtureClassNotFound when using instantiated fixtures on a fixture that...

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
上级 796a43de
*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]
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册