Xeno Campanoli
5/25/2008 12:39:00 AM
David A. Black wrote:
> Hi --
>
> On Sat, 24 May 2008, 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.
>
> Well, if my answer is correct, it's a very Rails-specific question :-)
Thank you David. I'll look at this right now, and try to have an answer
by tomorrow afternoon, as my evening is about to draw me away.'
Sincerely, Xeno
>
>> 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:
>>
>> I want to redefine the link_to method so it's seen in its new guise in
>> all the places where it's presently used. It seems to make most sense
>> to put the new redefinition in the module ApplicationHelpers, but I
>> believe that may short circuit the access, as I'm not seeing the
>> example I put in which always puts out a traceable constant, resulting
>> in the expected changes in my test web pages. So, and here is the
>> question:
>>
>> Can anyone suggest how I should specify an appropriately available
>> method for the correct module inside another module so that it
>> overrides the original in the fashion I desire? I presume this is a
>> simple problem, as it's what people do all the time in OO right? I'm
>> still a little green on these patterns yet I think.
>
> Have a look at relative_url_root, which I believe (though I haven't
> used it in a while) does what you want.
>
>
> David
>