RailsCasts Pro episodes are now free!

Learn more or hide this

Patrick Hereford's Profile

GitHub User: phereford

Comments by Patrick Hereford

Avatar

https://github.com/rails/arel/blob/master/lib/arel/predications.rb

ruby
tag = Tag.arel_table
Article.joins(:tags).where(tag[:name].in_all(["foo", "bar"]))

or maybe

ruby
tag = Tag.arel_table
Article.joins(:tags).where(tag[:name].matches_all(["foo", "bar"]))
Avatar

You should use arel_table.

ruby
tag = Tag.arel_table
Article.joins(:tags).where(tag[:name].in(["foo", "bar"]))