ruby-on-railsruby-on-rails-3paper-trail-gem

Find version where specific attribute has changed in papertrail


I'm using the Papertrail gem in my project and have searched extensively to try and find how to do the following.

What I'd like to do is find the version of my object where a specific attribute came to be a specific value i.e.

object.versions.where(attribute: "value")

Does anyone know if this is even possible with Papertrail?


Solution

  • As of PaperTrail 12.1 you can do

    object.versions.where_object_changes_to(attribute: "value")