This is definitely a source of confusion. The information out there is very mixed, so I did some testing to verify…
This currently (at least in master
branch) exists as Rails.application.default_url_options
(which is actually an alias for Rails.application.routes.default_url_options
).
This currently works already in regular controllers / views, except the information is taken from the request rather than from how the server was launched. Unfortunately, that means it does not work in Action Mailer views, since there is no request as such. I agree it would be nice to have though!
This is a good point. I think we could add a config option similar to config.require_master_key
but for default_url_options[:host]
. That would also be more reliable than hoping the user bumps into a “Missing host” error on their own in development.