From 522c0fdb555d54ca68d1acfd1bd8e67fd0040086 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 25 Jan 2012 14:42:08 -0800 Subject: The primary key is always initialized in the @attributes hash to nil (unless another value has been specified). --- .../test/cases/associations/has_many_through_associations_test.rb | 2 +- activerecord/test/cases/serialization_test.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb index 4612bc2618..9cc09194dc 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -738,7 +738,7 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase def test_select_chosen_fields_only author = authors(:david) - assert_equal ['body'], author.comments.select('comments.body').first.attributes.keys + assert_equal ['body', 'id'].sort, author.comments.select('comments.body').first.attributes.keys.sort end def test_get_has_many_through_belongs_to_ids_with_conditions diff --git a/activerecord/test/cases/serialization_test.rb b/activerecord/test/cases/serialization_test.rb index 61b04b3e37..31ba99a8ff 100644 --- a/activerecord/test/cases/serialization_test.rb +++ b/activerecord/test/cases/serialization_test.rb @@ -13,7 +13,8 @@ class SerializationTest < ActiveRecord::TestCase :created_at => Time.utc(2006, 8, 1), :awesome => false, :preferences => { :gem => 'ruby' }, - :alternative_id => nil + :alternative_id => nil, + :id => nil } end -- cgit v1.2.3