Skip to content

Commit

Permalink
Set destroyed=true in opt locking's destroy [rails#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 16bae77 commit d10ecfe
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
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def destroy #:nodoc:
end
end

@destroyed = true
freeze
end

Expand Down
3 changes: 2 additions & 1 deletion activerecord/test/cases/locking_test.rb
Original file line number Diff line number Diff line change
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 d10ecfe

Please sign in to comment.