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

Provide :touch option to save() to accommodate saving without updating t... #18225

Merged
merged 1 commit into from
Dec 28, 2014

Conversation

DanOlson
Copy link
Contributor

...imestamps. [#18202]

@DanOlson DanOlson force-pushed the update-without-changing-timestamps branch from 74523ad to 4f35c58 Compare December 28, 2014 01:45
def save(*)
create_or_update
def save(**args)
create_or_update(args)
Copy link
Contributor

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.

@DanOlson DanOlson force-pushed the update-without-changing-timestamps branch from 4f35c58 to 4fb4b14 Compare December 28, 2014 03:09
@sgrif
Copy link
Contributor

sgrif commented Dec 28, 2014

Looks like the tests are failing.

@DanOlson DanOlson force-pushed the update-without-changing-timestamps branch from 4fb4b14 to 3d46aa0 Compare December 28, 2014 03:31
@DanOlson
Copy link
Contributor Author

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
Copy link
Contributor

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)

Copy link
Contributor

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

@sgrif
Copy link
Contributor

sgrif commented Dec 28, 2014

Last set of minor comments, then this is good to go

@DanOlson DanOlson force-pushed the update-without-changing-timestamps branch from 3d46aa0 to e780e2f Compare December 28, 2014 04:22
sgrif added a commit that referenced this pull request Dec 28, 2014
…tamps

Provide :touch option to save() to accommodate saving without updating t...
@sgrif sgrif merged commit 3ba552f into rails:master Dec 28, 2014
@rafaelfranca
Copy link
Member

What is the difference of this and no_touch?

@sgrif
Copy link
Contributor

sgrif commented Dec 29, 2014

@rafaelfranca
Copy link
Member

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.

@rafaelfranca
Copy link
Member

Ah, no_touching is just when calling touch.

@DanOlson
Copy link
Contributor Author

I can certainly look into that.

On Dec 29, 2014, at 10:57 AM, Rafael Mendonça França notifications@github.com wrote:

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.


Reply to this email directly or view it on GitHub.

@sgrif
Copy link
Contributor

sgrif commented Dec 29, 2014

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.

@DanOlson DanOlson deleted the update-without-changing-timestamps branch December 29, 2014 18:13
claudiob added a commit to claudiob/rails that referenced this pull request Dec 29, 2014
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]
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.

3 participants