-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Provide :touch option to save() to accommodate saving without updating t... #18225
Provide :touch option to save() to accommodate saving without updating t... #18225
Conversation
74523ad
to
4f35c58
Compare
def save(*) | ||
create_or_update | ||
def save(**args) | ||
create_or_update(args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just use normal splat here.
4f35c58
to
4fb4b14
Compare
Looks like the tests are failing. |
4fb4b14
to
3d46aa0
Compare
Sorry, all green now. Had to adjust the signatures of the other methods in the inheritance chain. |
def _update_record(*) | ||
partial_writes? ? super(keys_for_partial_write) : super | ||
def _update_record(*args, **options) | ||
partial_writes? ? super(keys_for_partial_write, options) : super |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the double splat here as well? Not strictly necessary, but will allow for potential performance improvements on the ruby side (skipping a hash allocation)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually could this be written as:
def _update_record(*args)
partial_writes? ? super(keys_for_partial_write(*args) : super
Last set of minor comments, then this is good to go |
3d46aa0
to
e780e2f
Compare
…tamps Provide :touch option to save() to accommodate saving without updating t...
What is the difference of this and |
hmmmm. At least we can make the implementation of both use the same thing? I dislike the idea of having the same idea implemented in two places. |
Ah, |
I can certainly look into that.
|
Also even if we did use the same implementation for both, almost all of the code which changed was for the signature, not the actual implementation of skipping the timestamps. |
ActiveRecord::Base `save` and `save!` take an option boolean `:touch` parameter since rails#18225 (stems from rails#18202). This commit document that parameter. [ci skip]
...imestamps. [#18202]