Skip to content

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

Merged
sgrif merged 1 commit into
rails:masterfrom
DanOlson:update-without-changing-timestamps
Dec 28, 2014
Merged

sgrif merged 1 commit into
rails:masterfrom
DanOlson:update-without-changing-timestamps

Conversation

@DanOlson

Copy link
Copy Markdown
Contributor

...imestamps. [#18202]

@DanOlson
DanOlson force-pushed the update-without-changing-timestamps branch from 74523ad to 4f35c58 Compare December 28, 2014 01:45

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

sgrif commented Dec 28, 2014

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

Sorry, all green now. Had to adjust the signatures of the other methods in the inheritance chain.

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

sgrif commented Dec 28, 2014

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

What is the difference of this and no_touch?

@sgrif

sgrif commented Dec 29, 2014

Copy link
Copy Markdown
Contributor

@rafaelfranca

Copy link
Copy Markdown
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
Copy Markdown
Member

Ah, no_touching is just when calling touch.

@DanOlson

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

sgrif commented Dec 29, 2014

Copy link
Copy Markdown
Contributor

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