Docs: AR Optimistic Locking, lock_version

To address https://github.com/airblade/paper_trail/issues/163

[ci skip]
This commit is contained in:
Jared Beck 2015-06-22 12:04:39 -04:00
parent 7659688cf3
commit 9cac7bde36
1 changed files with 7 additions and 1 deletions

View File

@ -416,8 +416,10 @@ Undeleting is just as simple:
>> widget.save # the widget lives!
```
In fact you could use PaperTrail to implement an undo system, though I haven't had the opportunity yet to do it myself. However [Ryan Bates has](http://railscasts.com/episodes/255-undo-with-paper-trail)!
You could even use PaperTrail to implement an undo system, [Ryan Bates has!][3]
If your model uses [optimistic locking][1] don't forget to [increment your
`lock_version`][2] before saving or you'll get a `StaleObjectError`.
## Navigating Versions
@ -1261,3 +1263,7 @@ Many thanks to:
Copyright (c) 2011 Andy Stewart (boss@airbladesoftware.com).
Released under the MIT licence.
[1]: http://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html
[2]: https://github.com/airblade/paper_trail/issues/163
[3]: http://railscasts.com/episodes/255-undo-with-paper-trail