I have 2 models:
Subscriber
- id
- name:string
- email:string
Submission
- id
- name:string
- email:string
- path:string
- ip:string
They don’t have any relation.
I’d like to select all rows from subscribers and exclude rows with email address inserted in submission table where url equals ‘some/path’.
What is the most elegant way to do accomplish this with Rails?
I dont really get what you mean with: where url equals ‘some/path’
But i guess you can just add that as an extra condition…
if you solve it with a normal nested query you get:
So in active record this would be:
If you dont like to write that nested select query you can also do:
I didn’t test it, but it should be something along these lines.