-
Notifications
You must be signed in to change notification settings - Fork 903
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs: AR Optimistic Locking, lock_version
To address #163 [ci skip]
- Loading branch information
Showing
1 changed file
with
7 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 ([email protected]). | ||
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 |