diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index da72d1718e05f901f161285fe140e84cf888c6b4..65c7f3afbbef34dcfd1dfdd4da72047cf9e0fab0 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -559,7 +559,7 @@ def table_rows rows[table_name] = fixtures.map do |label, fixture| row = fixture.to_hash - if model_class && model_class < ActiveRecord::Base + if model_class && model_class < ActiveRecord::Model # fill in timestamp columns if they aren't specified and the model is set to record_timestamps if model_class.record_timestamps timestamp_column_names.each do |name| diff --git a/activerecord/test/cases/inclusion_test.rb b/activerecord/test/cases/inclusion_test.rb index ee32a71ca9a6eafc72bf683906d193236dcbd76e..2302761205095d78a94837237dde42247ef17e73 100644 --- a/activerecord/test/cases/inclusion_test.rb +++ b/activerecord/test/cases/inclusion_test.rb @@ -51,3 +51,15 @@ def test_mirrored_configuration ActiveRecord::Base.time_zone_aware_attributes = false end end + +class InclusionFixturesTest < ActiveRecord::TestCase + fixtures :teapots + + def test_fixtured_record + assert_equal "Bob", teapots(:bob).name + end + + def test_timestamped_fixture + assert_not_nil teapots(:bob).created_at + end +end diff --git a/activerecord/test/fixtures/teapots.yml b/activerecord/test/fixtures/teapots.yml new file mode 100644 index 0000000000000000000000000000000000000000..ff515beb452710340cb6b089c7177bc6efb44d72 --- /dev/null +++ b/activerecord/test/fixtures/teapots.yml @@ -0,0 +1,3 @@ +bob: + id: 1 + name: Bob diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb index 09c8c25d7487a4838c2118e31e96dbf04c318b3d..8706732230006f01dafb07af4eee35b2f5b503eb 100644 --- a/activerecord/test/schema/schema.rb +++ b/activerecord/test/schema/schema.rb @@ -598,6 +598,7 @@ def create_table(*args, &block) create_table :teapots, :force => true do |t| t.string :name + t.timestamps end create_table :topics, :force => true do |t|