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

Fix invalid version created_at value when using update_columns #1396

Closed

Conversation

iiwo
Copy link
Contributor

@iiwo iiwo commented Aug 1, 2022

Use the default(AR generated) timestamp for the Version#created_at value when using PaperTrail::RecordTrail#update_columns.

PaperTrail::RecordTrail#update_columns was previously setting Version#created_at as the recod updated_at value.
Since update_columns does not update timestamps - the previous update date was being used for the Version#created_at instead of the actual update date.

Fixes #1395


  • Wrote good commit messages.
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new
    code introduces user-observable changes.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.

@iiwo iiwo force-pushed the bug/update_columns_created_at branch from 571e165 to 399de21 Compare August 1, 2022 15:28
Use the default(AR generated) timestamp for the `Version#created_at` value when using `PaperTrail::RecordTrail#update_columns`.

`PaperTrail::RecordTrail#update_columns` was previously setting `Version#created_at` as the recod `updated_at` value.
Since `update_columns` does not update timestamps - the previous update date was being used for the `Version#created_at` instead of the actual update date.

Fixes paper-trail-gem#1395
@iiwo iiwo force-pushed the bug/update_columns_created_at branch from 399de21 to 7af51bd Compare August 1, 2022 15:38
Copy link

@marcelotoledo5000 marcelotoledo5000 left a comment

Choose a reason for hiding this comment

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

👍 Good call!!!

@gurgelrenan
Copy link
Member

Thanks for your P.R @iiwo . SGTM. I think we can merge. Do you see any problems @jaredbeck ?

@gurgelrenan gurgelrenan requested a review from jaredbeck August 3, 2022 02:11
@jaredbeck
Copy link
Member

Merged in #1405, preserving your authorship.

Thanks @iiwo for the fix, and thanks @gurgelrenan for reviewing.

@jaredbeck jaredbeck closed this Nov 12, 2022
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.

paper_trail.update_columns is setting an incorrect Version#created_at value
4 participants