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:
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.
Thanks for any suggestions.
Sincerely, Xeno C.
Droopy hacker on a Friday Evening…