I think you may extract `.compact.join("_").presence` to be more like:

```ruby
id:     (as ? [namespace, action, as] : [namespace, dom_id(object, action)]).compact.join("_").presence
```