Better avoid denials and write:
```
= link_to 'Delete Repository', (controller_name == "repositories" ? resource : parent), method: :delete, class: 'btn btn-danger'
```