Phillip Gawlowski wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Xeno Campanoli wrote: > | Please this is a Ruby question, not, at least as the main focus, a rails > | one, as you'll see if you read all the way through. > | > | Say, I've got a case in Rails where I want all my links to be prepended > | with something like ~u1/rrsw/thingies so I can see > | http://host/~u1/rrsw/thingies and http://host/~u2/rrsw/thingies instead > | of http://host:9001/thingies and http://host:9002/thingies for a rails > | tool that is used by some n projects. The rails part is apparently not > | configurable, so I'm looking at redefining rails methods like link_to to > | stick the path in there. This should be reasonable, but I'm stuck on a > | ruby problem: No no no no no no! I have all the other stuff working. I've got UserDir and ProxyPass directives that get all the stuff set up initially from my http://host:n to my http://host/~u1/rrsw like I want. All I need now is to get all the URLs that are presently rendered in the markup as /something to be ~u1/rrsw/something. That is all I need. I have the rest working. So, thank you for your feedback. It is interesting for other reasons, but what I was asking about was the very thing you said you were unable to answer; nothing more. Sincerely, Xeno xc > > You are aware that the port of the URL is not under Rails' nor Ruby's > control per se (it is the domain of the webserver)? > > URLs are composed in (roughly) six parts: the > [protocol]://[host]:[port]/[user_directory]/[directory/that/app/uses/or/rewrites]/[document_requested.suffix] > > > Of those, only the directory and explicit document are under control by > any given web application. > > Further, you can only have one server listen on any given port (though, > one server can listen on an unlimited number of ports). > > What you want, can be achieved by using Apache + mod_rails. > > Uou can get the ~u1/~u2 part, by having different users on a, for > example, UNIX based OS have their own web_root (or web_home, as it can > be called, by convention), which would be reachable as > host/~username/index.html (for example). > > Details of implementing such a setup can be found in various ways on, > for example, <http://howtoforge.org>. > > > As far as overriding a Ruby method: You can usually achieve that by > reopening the class, adding an alias for the old method, and defining > your own implementation. Be careful, though, when you do. > > Where to do that so Rails picks up a change to link_to, I do not know (I > suspect it is in ActiveSupport, though). > > - -- > Phillip Gawlowski > Twitter: twitter.com/cynicalryan > Blog: http://justarubyist.blogspot.com > > ~ - You know you've been hacking too long when... > ...your complexion has turned pale from being constantly irradiated by the > monitor. > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.8 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkg3sU8ACgkQbtAgaoJTgL/zGgCcD/x24SNTx8OFslWJ5fX5A5gq > x8UAniPPYbQl1pPj/ytTyFeoxS5Hp7N7 > =Z9nu > -----END PGP SIGNATURE----- > >