aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/attribute_methods_test.rb
diff options
context:
space:
mode:
authorJulius de Bruijn <julius.bruijn@sponsorpay.com>2011-11-30 17:56:16 +0100
committerJon Leighton <j@jonathanleighton.com>2011-11-30 23:47:16 +0000
commit4e380828ffa8279740256164c6b83148cf0cbf13 (patch)
treed91bb7b1732dad4602d12668cd734d48cb93d8fc /activerecord/test/cases/attribute_methods_test.rb
parent7a4949e7d5be37f64bf6a1f9dda6f427fbb5ac40 (diff)
downloadrails-4e380828ffa8279740256164c6b83148cf0cbf13.tar.gz
rails-4e380828ffa8279740256164c6b83148cf0cbf13.tar.bz2
rails-4e380828ffa8279740256164c6b83148cf0cbf13.zip
If the table behind has no primary key, do not ask again and just return nil.
Diffstat (limited to 'activerecord/test/cases/attribute_methods_test.rb')
-rw-r--r--activerecord/test/cases/attribute_methods_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb
index 12e5715710..7c9383b194 100644
--- a/activerecord/test/cases/attribute_methods_test.rb
+++ b/activerecord/test/cases/attribute_methods_test.rb
@@ -53,6 +53,11 @@ class AttributeMethodsTest < ActiveRecord::TestCase
assert Boolean.find(b4.id).attribute_present?(:value)
end
+ def test_caching_nil_primary_key
+ Minimalistic.expects(:reset_primary_key).returns(nil).once
+ Minimalistic.create!
+ end
+
def test_attribute_keys_on_new_instance
t = Topic.new
assert_equal nil, t.title, "The topics table has a title column, so it should be nil"