How about this?

```ruby
object.responds_to?(:id) ? object.id : object
```

Probably should also document the places where you can pass in a string instead of an object.