This blog is part of our Rails 5 series.
has added OR method
to Active Relation for generating queries with OR clause.
which is logical union of
Some Examples of OR usage
With group and having
With combination of scopes
Constraints for using OR method
The two relations must be structurally compatible,
they must be scoping the same model, and
they must differ only by
In order to use OR operator,
neither relation should have a
distinct is passed only with one relation,
then it throws
ArgumentError as shown above.
As of now, we can use
when passed with both the relations and with same the parameters.
There is an issue open
in which discussions are ongoing regarding completely
stopping usage of
distinct when using with