Skip to content

Commit

Permalink
Set destroyed=true in opt locking's destroy [#5058 state:resolved]
Browse files Browse the repository at this point in the history
Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
jlewallen authored and josevalim committed Jul 14, 2010
1 parent 046c900 commit 8298bef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions activerecord/lib/active_record/locking/optimistic.rb
Expand Up @@ -128,6 +128,7 @@ def destroy_with_lock #:nodoc:
end
end

@destroyed = true
freeze
end

Expand Down
3 changes: 2 additions & 1 deletion activerecord/test/cases/locking_test.rb
Expand Up @@ -53,7 +53,8 @@ def test_lock_destroy
assert_raises(ActiveRecord::StaleObjectError) { p2.destroy }

assert p1.destroy
assert_equal true, p1.frozen?
assert p1.frozen?
assert p1.destroyed?
assert_raises(ActiveRecord::RecordNotFound) { Person.find(1) }
end

Expand Down

0 comments on commit 8298bef

Please sign in to comment.