user3895395
user3895395

Reputation: 511

Fetching a PaperTrail::Version by ID

How can I fetch a PaperTrail::Version based on the ID of the version record itself?

I really need a way to get a specific version and this seems like the most direct route but cannot see any mention in the docs.

I tried PaperTrail::Version.where_object(id: 5) however this is returning the object with ID 5 not the Version

Any help appreciated!

Upvotes: 1

Views: 794

Answers (1)

Jared Beck
Jared Beck

Reputation: 17528

How can I fetch a PaperTrail::Version based on the ID of the version record itself?

PaperTrail::Version.find(id)

PaperTrail::Version is a regular ActiveRecord model. PT encourages the use of regular methods like find or where.

Upvotes: 4

Related Questions