Updates Readme ignore and only sections
- Updates ignore section to include an example with a Hash containing a proc. - Fixes only section example to use an array as the argument.
This commit is contained in:
parent
fa8b1b270d
commit
fe591c1d14
12
README.md
12
README.md
|
@ -428,6 +428,14 @@ a.versions.length # 2
|
|||
a.paper_trail.previous_version.title # 'My Title'
|
||||
```
|
||||
|
||||
The `:ignore` option can also accept `Hash` arguments that we are considering deprecating.
|
||||
|
||||
```ruby
|
||||
class Article < ActiveRecord::Base
|
||||
has_paper_trail ignore: [:title, { color: proc { |obj| obj.color == "Yellow" } }]
|
||||
end
|
||||
```
|
||||
|
||||
#### Only
|
||||
|
||||
Or, you can specify a list of the `only` attributes you care about:
|
||||
|
@ -450,11 +458,11 @@ a.versions.length # 2
|
|||
a.paper_trail.previous_version.content # nil
|
||||
```
|
||||
|
||||
The `:ignore` and `:only` options can also accept `Hash` arguments.
|
||||
The `:only` option can also accept `Hash` arguments that we are considering deprecating.
|
||||
|
||||
```ruby
|
||||
class Article < ActiveRecord::Base
|
||||
has_paper_trail only: { title: Proc.new { |obj| !obj.title.blank? } }
|
||||
has_paper_trail only: [{ title: Proc.new { |obj| !obj.title.blank? } }]
|
||||
end
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue