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

Touch not saving changes. touch_with_version did #1076

Closed
key88sf opened this issue Apr 17, 2018 · 4 comments
Closed

Touch not saving changes. touch_with_version did #1076

key88sf opened this issue Apr 17, 2018 · 4 comments

Comments

@key88sf
Copy link

key88sf commented Apr 17, 2018

Simple example of the difference:

> p = Person.last
> p.name = "New Name"
> p.touch
# UPDATE people SET updated_at = ....

^^ This does not update the name in either the database or the versions table.

> p.paper_trail.touch_with_version
# UPDATE people SET updated_at=..., name='New Name' ...

^^ This updates both the name in the database, and adds a correct version row for the updated name in the versions table.

This is a huge difference in behavior, and one which is relied upon likely by many people besides us -- it is integral to the behavior of the counter_culture gem's support of the with_papertrail option.

Please either do not deprecate this, or fix the behavior of touch to be equivalent. Right now they are two completely different behaviors.

@westonganger
Copy link
Contributor

Okay so touch_with_version should almost be called save_with_version

@key88sf
Copy link
Author

key88sf commented Apr 17, 2018

Sure, that would be fine. I definitely do not think this should just be deprecated though, as it's completely different behavior.

@jaredbeck
Copy link
Member

Closing via #1078

Okay so touch_with_version should almost be called save_with_version

I like the idea of having a save_with_version method, but if that's what it's called, I'd rather have it just do a save and not (simulate) a touch. So, that led me to the implementation in #1078. I hope it works for you, @key88sf.

@key88sf
Copy link
Author

key88sf commented Apr 23, 2018

Yes thanks!

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

No branches or pull requests

3 participants