In controller a base URL could be got using request
object, but my process is a worker thread started from initializer, and it doesn't have access to request
.
Get Rails base URL if not in controller
990 views Asked by Paul At
1
In controller a base URL could be got using request
object, but my process is a worker thread started from initializer, and it doesn't have access to request
.
If you don't have a request (which you don't, in the context of a background worker), then you can't tell the URL automatically and the only way is to set it explicitly. You could set it as an environment variable, or set it as a constant in an initializer, and then get it from there.