On Thu, 2006-07-20 at 17:53 -0700, Chris Wanstrath
wrote:> Hey guys.
>
>
> I''ve been playing with RedirectHandler and it''s pretty
neat, but I
> question its usefulness.
> Here''s the deal: if I register a RedirectHandler on
''/javascripts'' and
> try to redirect to ''/javascripts/x'', everything explodes.
Is there a
> way around this? I am registering my RedirectHandler using the
''uri''
> method in a file passed to mongrel_rails via -S.
>
It does regex and procs as well I believe. I haven''t touched it in a
bit but take a look and if you see nothing I''ll dig it up.
>
> Before RedirectHandler was included in Mongrel we had worked out a
> solution: a gem_plugin we joking called mongrel_rewrite.
>
>
> You simply create ''config/rewrites.rb'' in your Rails
root. Ours looks
> like this:
> RewriteRules = {
> /\/(.+)\/(\w+)\.\d+\.(js|css|gif|jpg|png)/ =>
''/$1/$2.$3''
> }
>
> Is there a use for this? Am I just setting up my RedirectHandlers
> wrong? I''d like to do things the Official way, so any help on the
> RedirectHandler would be appreciated.
Just go ahead and offer it up as a gem plugin. If you''re not sure how
to make one I can walk you through it, but it''s pretty simple.
I''d say
if you''re getting in there monkey patching then you''re in for
a world of
hurt pretty soon since code is changing right there. Test it with the
0.3.13.4 pre-release first:
gem install mongrel --source=http://mongrel.rubyforge.org/releases/
Otherwise, just roll it out and people who need it will install.
That''s
the great thing about gem plugins and Mongrel, you don''t have to beg
"core" to add your features (and you don''t need subversion).
Now, if you could find a way to merge your functionality into the
current redirect handler then that''d be patch worthy. Check it out and
let me know (tests and docs too please).
--
Zed A. Shaw
http://www.zedshaw.com/
http://mongrel.rubyforge.org/
http://www.railsmachine.com/ -- Need Mongrel support?