Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Events::Update by moving the timestamp-copying feature up the stack #1406

Merged
merged 2 commits into from
Nov 26, 2022

Conversation

jaredbeck
Copy link
Member

@jaredbeck jaredbeck commented Nov 12, 2022

Also, on a related note, forbid certain metadata keys, such as created_at. The metadata feature is mainly intended for new columns. Hopefully no one is using these forbidden metadata keys, because that seems .. dangerous. More apropos to this PR, if we support such keys, then moving the timestamp-copying feature out of Events::Update might not be possible.

@jaredbeck
Copy link
Member Author

@iiwo WDYT?

Copy link
Contributor

@iiwo iiwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iiwo WDYT?

looks great! moving that timestamp manipulation to the build_version_on_update method is a nice refactor - that's definitely cleaner

lib/paper_trail/events/base.rb Outdated Show resolved Hide resolved
lib/paper_trail/record_trail.rb Show resolved Hide resolved
.. to RecordTrail#build_version_on_update.

This seems cleaner to me than the previous `delete(:created_at)` solution.
This way, the feature lives in a single file, instead of two.
@jaredbeck jaredbeck merged commit 7a85af9 into master Nov 26, 2022
@jaredbeck jaredbeck deleted the refactor_update_event branch November 26, 2022 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants