Professional Documents
Culture Documents
And making use of it, you can be able to see all the
previous versions of the file and if required you
can rollback to a previous version of your choice.
You can even undo all the changes after a record
has been destroyed so as to restore it completely.
PaperTrail
PaperTrail to automatically keep track of what
happened to our documents.
# Gemfile
gem 'paper_trail'
Now, 3 steps in one line to get it to work :
bundle install && bundle exec rails generate
paper_trail:install && bundle exec rake db:migrate
Restart your server before continuing.
# app/models/user.rb
class User < ActiveRecord::Base
has_many :documents
def
self.find_version_author(version)
find(version.terminator)
end
end
Now, lets add the actual list of versions to
the edit document view as a partial :
Ruby:
MetaData
Features:
1.Stores every update and destroy.
2.Only store updates that has been changed.
3.You can have all the version, including the
original, if it even destroyed once.
4.You can get every version even if the schema
has since changed.
5.Automatically record a responsible controller
current user method.
6.Allows you to set who is responsible at modellevel (useful for migrations).
7.No configuration necessary.
8.Can be turned off/on.
9.Everything can be stored in a single database
table.
10.Thoroughly tested.
Interested in installation