Skip to content

Commit

Permalink
Use an app specific name for abstract version class to avoid autoload…
Browse files Browse the repository at this point in the history
…ing conflict
  • Loading branch information
Hugo Hache committed Sep 2, 2021
1 parent afb393f commit 559211a
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1216,17 +1216,20 @@ class PostVersion < PaperTrail::Version
end
```

If you only use custom version classes and don't have a `versions` table, you
must let ActiveRecord know that the `PaperTrail::Version` class is an
`abstract_class`.
If you only use custom version classes and don't have a `versions` table, you must
let ActiveRecord know that your base version class (eg. `ApplicationVersion` below)
class is an `abstract_class`.

```ruby
# app/models/paper_trail/version.rb
module PaperTrail
class Version < ActiveRecord::Base
include PaperTrail::VersionConcern
self.abstract_class = true
end
# app/models/application_version.rb
class ApplicationVersion < ActiveRecord::Base
include PaperTrail::VersionConcern
self.abstract_class = true
end

class PostVersion < ApplicationVersion
self.table_name = :post_versions
self.sequence_name = :post_versions_id_seq
end
```

Expand Down

0 comments on commit 559211a

Please sign in to comment.