From 02021d89b1928e9869b0038afc08cb6b3e719014 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Fri, 11 Aug 2006 23:38:46 +0000 Subject: Tweak fixtures so they don't try to use a non-ActiveRecord class. [Kevin Clark] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4752 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/CHANGELOG | 2 ++ activerecord/lib/active_record/fixtures.rb | 2 +- activerecord/test/fixtures_test.rb | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 3f2ac9fa3b..5958ba6880 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Tweak fixtures so they don't try to use a non-ActiveRecord class. [Kevin Clark] + * Remove ActiveRecord::Base.reset since Dispatcher doesn't use it anymore. [Rick Olson] * Document find's :from option. Closes #5762. [andrew@redlinesoftware.com] diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 9eb3b5792b..5910af75ca 100755 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -395,7 +395,7 @@ class Fixture #:nodoc: klass = @class_name.constantize rescue nil list = @fixture.inject([]) do |fixtures, (key, value)| - col = klass.columns_hash[key] unless klass.nil? + col = klass.columns_hash[key] if klass.kind_of?(ActiveRecord::Base) fixtures << ActiveRecord::Base.connection.quote(value, col).gsub('\\n', "\n").gsub('\\r', "\r") end list * ', ' diff --git a/activerecord/test/fixtures_test.rb b/activerecord/test/fixtures_test.rb index 88f01c8a05..e33d12e703 100755 --- a/activerecord/test/fixtures_test.rb +++ b/activerecord/test/fixtures_test.rb @@ -343,3 +343,13 @@ class InvalidTableNameFixturesTest < Test::Unit::TestCase end end end + +class DevelopersProject; end; + +class ManyToManyFixturesWithClassDefined < Test::Unit::TestCase + fixtures :developers_projects + + def test_this_should_run_cleanly + assert true + end +end \ No newline at end of file -- cgit v1.2.3