You should validate the presence of the association rather than the id.

Example:

```ruby
validates :mugshot, presence: true
```

There are some situations where this would prevent the model from being saved.

Example:

```ruby
@mugshot = Mugshot.new
@vote = Mugshot.votes.build(user: current_user)

@mugshot.save
```

This would fail to save the vote because the id of the mugshot doesn't exist yet, deeming the vote invalid. If it's only checking for the presence of the association, it will save both the mugshot and the vote successfully. There is still the fallback with the database constraint that will make sure that we don't actually save any votes without a mugshot id.