Skip to content

Add an equivalent to originator (version.previous.whodunnit) for event #1537

@walterdavis

Description

@walterdavis

Thank you for your contribution!

Due to limited volunteers, issues that do not follow this template will be
closed without comment.

Is your feature suggestion related to a problem? Please describe.

We use PaperTrail to present on screen a list of changes to a record over time. To do this, we first show the "live" state, then use paper_trail.previous_version to mutate the record and re-render. For each line, we show who made the change and when, using the originator method and the timestamp from the mutated record.

We also wanted to have the correct "verb" in that attribution, to indicate whether the record was imported by the system, created by a named user, or updated by a different user. In fighting through an off-by-one problem with these attribution lines, I discovered there was no equivalent to originator for the version's event, and I initially resorted to version.previous.event long-hand in the template (where I never want to have logic).

Describe the solution you'd like to build

I would like to have a parallel construction of the originator tooling (wrapping whodunnit), but for the event, so there is a consistent API when showing a reified record in a timeline setting like this. I am not sure what the name should be, because we want this to expose the previous event; the one that made the current version of the record into what it is at the moment. originating_event is too long, but captures the intent.

Describe alternatives you've considered

The only alternative I can imagine would be to use a different library, one which starts from a different premise (recording after change, or recording both before and after change), which I would rather not do at this point. The existing work-around could be made cleaner in my own code, and I plan to do that separately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions