Skip to content

Commit

Permalink
Docs: AR Optimistic Locking, lock_version
Browse files Browse the repository at this point in the history
To address #163

[ci skip]
  • Loading branch information
jaredbeck committed Jun 22, 2015
1 parent 7659688 commit 9cac7bd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

0 comments on commit 9cac7bd

Please sign in to comment.