This should also work:

```ruby
where('participant_person_links.relationship_code' => 1).joins(:pbs_lists).merge(PbsList.is_hospital)
```

It's an improvement because you no longer need to specify internal details of the `PbsList` class.