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 saving changes on #touch #1084

Closed

Conversation

fukayatsu
Copy link
Contributor

from: #1073 (comment)

Related to #1076

record = described_class.create(name: "Alice")
record.touch
expect(record.versions.last.reify.name).to eq("Alice")
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

On master branch, this spec passes on AR4.2 and AR5.0 but fails on AR5.1 and AR 5.2

Please see https://travis-ci.org/fukayatsu/paper_trail/builds/378643661 .

jaredbeck added a commit that referenced this pull request May 14, 2018
@jaredbeck
Copy link
Member

Thanks for the PR, Fukaya-san. The test you added is good.

My only concern is the in_after_callback: argument.

-        r.paper_trail.record_update(force: true, in_after_callback: true)
+        r.paper_trail.record_update(force: true, in_after_callback: false)

PT installs an after_touch callback. It is, actually an after callback. So, if we say in_after_callback: false, that would be confusing.

First, I thought maybe we should change the name of the argument? But, it's not easy to come up with a better name.

How about just passing another argument?

-        r.paper_trail.record_update(force: true, in_after_callback: true)
+        r.paper_trail.record_update(force: true, in_after_callback: true, is_touch: true)

Please see #1085

@fukayatsu
Copy link
Contributor Author

@jaredbeck Thank you for the quick response.
#1085 looks good to me!

@fukayatsu fukayatsu closed this May 15, 2018
@fukayatsu fukayatsu deleted the fix-touch-not-saving-changes branch May 15, 2018 01:02
jaredbeck added a commit that referenced this pull request May 15, 2018
@jaredbeck
Copy link
Member

Fixed by #1085, released in 9.0.2. Thanks, Fukaya-san.

aried3r pushed a commit to aried3r/paper_trail that referenced this pull request Dec 14, 2020
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