this logic should be placed in model like:

```
class Project
 ...
after_save :update_head, if: :default_branch_changed?
```