Probably bikeshedding but this passes all of the tests too:

```ruby
params[:path].to_s.gsub(%r{\A/+}, '').presence || params[:id]
```

AKA there are no tests for the second sub so I refactored it away ;-)