Undo and redo behavior is easy to add with a versioning gem such as Paper Trail. Learn how to add an undo link to any model’s flash message.

Read more at the source