What about moving this to the `Host` model? Something like:
```ruby
  def self.canonical_hostname(hostname)
    uri.host.sub(/^aka-/, '').sub(/^aka\./, 'www.')
  end
```

Then it can be easily shared and tested directly.