Document :skip option.

This commit is contained in:
Andy Stewart 2011-11-09 11:06:17 +01:00
parent d4e8525702
commit 3cd671fc03
2 changed files with 11 additions and 0 deletions

View File

@ -215,6 +215,14 @@ This means that only changes to the `title` will save a version of the article:
Passing both `:ignore` and `:only` options will result in the article being saved if a changed attribute is included in `:only` but not in `:ignore`.
You can skip fields altogether with the `:skip` option. As with `:ignore`, updates to these fields will not create a new `Version`. In addition, these fields will not be included in the serialised version of the object whenever a new `Version` is created.
For example:
class Article < ActiveRecord::Base
has_paper_trail :skip => [:file_upload]
end
## Reverting And Undeleting A Model

View File

@ -16,6 +16,9 @@ module PaperTrail
# :class_name the name of a custom Version class. This class should inherit from Version.
# :ignore an array of attributes for which a new `Version` will not be created if only they change.
# :only inverse of `ignore` - a new `Version` will be created only for these attributes if supplied
# :skip fields to ignore completely. As with `ignore`, updates to these fields will not create
# a new `Version`. In addition, these fields will not be included in the serialized versions
# of the object whenever a new `Version` is created.
# :meta a hash of extra data to store. You must add a column to the `versions` table for each key.
# Values are objects or procs (which are called with `self`, i.e. the model with the paper
# trail). See `PaperTrail::Controller.info_for_paper_trail` for how to store data from