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

Where satisfies: constrained arel, block with method, use where chain #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brunvez
Copy link
Owner

@brunvez brunvez commented Apr 16, 2021

Summary

Other Information

@@ -153,5 +153,33 @@ def test_rewhere_with_infinite_range

assert_equal expected.to_a, relation.to_a
end

def test_where_satisfies
relation = Post.where.satisfies { |post| (post.author_id != 1).and(post.id > 2) }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the wharel method, the satisfies after the where seems confusing (at least to me). Do Rails provide another API similar to this one?

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.

2 participants