1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

9 commits

Author SHA1 Message Date
Kasper Timm Hansen
14f35cde18
We don't really need all these to_a calls; fine to do a single check but rely on query otherwise 2021-03-03 16:05:45 +01:00
Kasper Timm Hansen
17854e69b3
Can just test this inline 2021-03-03 16:03:56 +01:00
Kasper Timm Hansen
89a213b59d
Clearer when this post is extracted 2021-03-03 16:03:21 +01:00
Kasper Timm Hansen
bfa1c36333
Style 2021-03-03 16:02:00 +01:00
Kasper Timm Hansen
32a69da269
Let's simplify the internal assertion here, doesn't need to a yield argument 2021-03-03 15:58:27 +01:00
Jorge Manrubia
b19cd20f63
Make .excluding work when a nil argument is passed
The change from https://github.com/rails/rails/pull/41465 was a
breaking change. Before, `.without` was delegated to `Array` and worked
with nil arguments. This change restores that old behavior.
2021-03-03 09:14:34 -05:00
Jorge Manrubia
e10e6ab1d4
Make .excluding work when no arguments are passed
The change from https://github.com/rails/rails/pull/41465 was a
breaking change. Before, `.without` was delegated to `Array` and worked
with empty arguments. This change restores that old behavior.
2021-03-03 07:48:57 -05:00
Ashik Salman
3317e9913e Added #without as alias for #excluding. 2021-02-17 01:11:14 +05:30
Glen Crawford
690fdbb2b9 Implemented ActiveRecord::Relation#excluding method.
This method excludes the specified record (or collection of records) from the resulting relation.

For example: `Post.excluding(post)`, `Post.excluding(post_one, post_two)`, and `post.comments.excluding(comment)`.

This is short-hand for `Post.where.not(id: post.id)` (for a single record) and `Post.where.not(id: [post_one.id, post_two.id])` (for a collection).
2021-02-17 00:16:09 +11:00