diff --git a/README.md b/README.md index 2825f4b2..0d3e163c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lib/paper_trail/has_paper_trail.rb b/lib/paper_trail/has_paper_trail.rb index 79627a65..8b3cf55a 100644 --- a/lib/paper_trail/has_paper_trail.rb +++ b/lib/paper_trail/has_paper_trail.rb @@ -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