I want to get all Foos which have at least one Bar with type "Apple", but also do NOT have a Bar with type "Orange" in the schema:

```
Foo
----
id

Bar
----
id
foo_id
type

```

If my data were this:

```
Foos
----
| id |
| 1  |
| 2  |
| 3  |

Bars
----
| id | foo_id | type   |
| 1  | 1      | Apple  |
| 2  | 1      | Orange |
| 3  | 3      | Apple  |

```

This query would return only Foo with ID=3, since 1 has an Apple but also an Orange, and 2 has no Orange but also has no Apple.

Also, I will tag this post with Rails because an ActiveRecord solution would be preferred but isn't necessary.