These days, I write less and less ruby and more and more golang. I will continue to maintain this project, because there are people using it (don't worry, I won't let you down!).
That being said I would love if someone could take over. Please let me know in that issue if you're interested.
This gem provides #any_of and #none_of on ActiveRecord.
#any_of is inspired by any_of from mongoid.
Its main purpose is to both :
- remove the need to write a sql string when we want an
OR - allows to write dynamic
ORqueries, which would be a pain with a string
It allows to compute an OR like query that leverages AR's #where syntax:
User.where.any_of(first_name: 'Joe', last_name: 'Joe')
# => SELECT * FROM users WHERE first_name = 'Joe' OR last_name = 'Joe'You can separate sets of hash condition by explicitly group them as hashes :
User.where.any_of({first_name: 'John', last_name: 'Joe'}, {first_name: 'Simon', last_name: 'Joe'})
# => SELECT * FROM users WHERE ( first_name = 'John' AND last_name = 'Joe' ) OR ( first_name = 'Simon' AND last_name = 'Joe' )Each #any_of set is the same kind you would have passed to #where :