I feel like I’m just missing an environmental variable here, but is there anyway to get the FQDN and port that a Rails server is listening on? I feel like there should be a variable like RAILS_URL or something. I’d like to access it from a model.
Share
I’ve gotten around this by setting an environment variable with the application’s URL as part of the script that runs Mongrel. The env. var. is then available to Ruby, and you can even set a global like RAILS_ROOT in /config/environment.rb
You can also investigate the request object:
http://perma-link.appspot.com/k
Pass values returned from the request object into the Model when needed.