parent
ecd1df7b31
commit
411050cd00
18
README.md
18
README.md
|
@ -984,28 +984,20 @@ then there is no need to use `attr_accessible`.
|
||||||
|
|
||||||
## Single Table Inheritance (STI)
|
## Single Table Inheritance (STI)
|
||||||
|
|
||||||
PaperTrail supports [Single Table Inheritance][39], but the base
|
PaperTrail supports [Single Table Inheritance][39], and even supports an
|
||||||
model must be versioned (must call `has_paper_trail`).
|
un-versioned base model, as of 23ffbdc7e1.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
# correct
|
|
||||||
class Fruit < ActiveRecord::Base
|
|
||||||
has_paper_trail
|
|
||||||
end
|
|
||||||
class Banana < Fruit
|
|
||||||
end
|
|
||||||
|
|
||||||
# incorrect
|
|
||||||
class Fruit < ActiveRecord::Base
|
class Fruit < ActiveRecord::Base
|
||||||
|
# un-versioned base model
|
||||||
end
|
end
|
||||||
class Banana < Fruit
|
class Banana < Fruit
|
||||||
has_paper_trail
|
has_paper_trail
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
In order to support [polymorphic associations][40], when PaperTrail inserts
|
However, there is a known issue when reifying [associations](#associations),
|
||||||
records in the the `versions` table, it saves the name of the base class in the
|
see https://github.com/airblade/paper_trail/issues/594
|
||||||
`item_type` column, as required by ActiveRecord.
|
|
||||||
|
|
||||||
## Custom Version Classes
|
## Custom Version Classes
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue