Testing ActiveRecord::Cte
-
bundle
-
rails db:seed
to create 4 posts, 3 of which havecomments_count
ORtags_count
of more than 0. -
In
rails console
,Post.where.not(comments_count: ..0). or(Post.where.not(tags_count: ..0)). count
correctly returns
3
. -
The example from the documentation,
Post.with( posts_with_comments: Post.where("comments_count > ?", 0), posts_with_tags: Post.where("tags_count > ?", 0) ). count
incorrectly returns
4
.