ruby-on-railsrubypaper-trail-gem

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!


Solution

  • 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.