Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Added OR and NOT operators for ActiveRecord::Relation instances #11

Closed
wants to merge 1 commit into from

Conversation

bcardarella
Copy link
Contributor

Now we can do:

Developer.where(:salary.gt => 70000) - Developer.where(:company_id.not_eq => 2)

@bcardarella
Copy link
Contributor Author

On second thought, maybe these operators are best reserved for UNION, INTERSECT and EXCEPT. It seems that UNION has already made it into Arel/master: brynary/arel@d532b7e

@bcardarella
Copy link
Contributor Author

...which I've added here: rails/arel#24

So if it gets accepted all three SQL Set Operators will be in there.

What I propose:

+: for merge

&: for intersect

|: for union

-: for except

This is using the convention for the Array class.

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant