-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Deprecate passing rewhere
to merge
#45498
Conversation
Setting `rewhere: false` is deprecated and will be removed in Rails 7.2 | ||
in Rails 7.2 merge will no longer maintain both conditions, | ||
and will be consistently replaced by the latter condition. |
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.
Setting `rewhere: false` is deprecated and will be removed in Rails 7.2 | |
in Rails 7.2 merge will no longer maintain both conditions, | |
and will be consistently replaced by the latter condition. | |
`Relation#merge(rewhere: false)` is deprecated without replacement, | |
and will be removed in Rails 7.2 |
The proposed message would've looked quite odd after squashing ("in Rails 7.2 in Rails 7.2").
The best thing a deprecation message can communicate is not why it's changing, but what the user needs to do to respond... in this case, we don't have a good answer beyond "figure it out for yourself"; that's not generally an ideal thing to dump onto the user, but in this case we're not expecting people to actually be using this option at all, so a more abrupt "this is going to stop working, soz" seems acceptable.
IMO we don't need to try to fit a "why this is better" into a handful of words here, because 1) the user doesn't care that it's better in principle: what they have is working for them, and 2) the user knows what the option does, because they recently went out of their way to adopt it.
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.
Isn't #and a possible alternative here?
Setting `rewhere: true` is deprecated. `rewhere: true` is the default behavior since Rails 7.0. | ||
This option is no longer needed and will be removed in Rails 7.2 |
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.
Setting `rewhere: true` is deprecated. `rewhere: true` is the default behavior since Rails 7.0. | |
This option is no longer needed and will be removed in Rails 7.2 | |
Specifying `Relation#merge(rewhere: true)` is deprecated, as that has now been | |
the default since Rails 7.0. Setting the rewhere option will error in Rails 7.2 |
A lot of deprecation messages end in some form of "will be removed in Rails x.y", for good reason, but sometimes I think there are better ways of establishing the same "you need to act before your next upgrade".
523c60d
to
d8294b2
Compare
Thanks @matthewd! I updated both messages and tried to make them more similar while I was there. for the
I think we could still add more information, but I am relying on the fact that if you are using for
I adopted your message almost exactly, except I said the option is removed instead of the option will error since I am not confident it will error unless we purposefully make it error. I don't feel strongly, about either message, so I am happy to adjust them again! |
4c52937
to
3c580d3
Compare
In 6.1 rewhere was added to `merge` in rails#39250 to get more consistent `merge` behavior. Sometimes maintaining both conditions on `merge` calls was removed as default behavior in 7.0: rails@515aa1e the release notes, https://github.com/rails/rails/blob/630342e3203c0414f834de43832c77e4a1315172/guides/source/7_0_release_notes.md?plain=1#L211 and the original deprecation warning, https://github.com/rails/rails/blob/6-1-stable/activerecord/lib/active_record/relation/where_clause.rb#L169-L173 both show `rewhere: true` as a way to migrate your 6.1 app to 7.0. Now that 7.0 is released we can deprecate `rewhere` as an option on merge and eventually remove the non-rewhere version of `merge`.
3c580d3
to
12d6d98
Compare
On second thought I like @matthewd's wording a lot. |
In 6.1 rewhere was added to
merge
in #39250 to get more consistentmerge
behavior.Sometimes maintaining both conditions on
merge
calls was removed as default behavior in 7.0: 515aa1ethe release notes,
rails/guides/source/7_0_release_notes.md
Line 211 in 630342e
and the original deprecation warning,
https://github.com/rails/rails/blob/6-1-stable/activerecord/lib/active_record/relation/where_clause.rb#L169-L173
both show
rewhere: true
as a way to migrate your 6.1 app to 7.0.Now that 7.0 is released we can deprecate
rewhere
as an option on merge and eventually remove the non-rewhere version ofmerge
.