Am I wrong in thinking that the id and new_record? attributes should be reverted if a transaction is rolled back? They don't currently revert so the id attribute is left with a value that isn't actually in the database and new_record? is returning false even though it should be true.
Here's a test demonstrating what I'm talking about:
topic_count_before_save = Topic.count
new_topic = Topic.new(
:title => "A new topic",
:author_name => "Ben",
:author_email_address => "email@example.com",
:written_on => "2003-07-16t15:28:11.2233+01:00",
:last_read => "2004-04-15",
:bonus_time => "2005-01-30t15:28:00.00+01:00",
:content => "Have a nice day",
:approved => false)
new_record_snapshot = new_topic.new_record?
id_present = new_topic.has_attribute?(Topic.primary_key)
id_snapshot = new_topic.id
topic_count_after_save = Topic.count
assert_equal topic_count_before_save, topic_count_after_save
assert_equal new_record_snapshot, new_topic.new_record?, "The topic should have its old new_record value"
assert_equal id_snapshot, new_topic.id, "The topic should have its old id"
assert_equal id_present, new_topic.has_attribute?(Topic.primary_key)