Query String in routes


#1

Is there any way to access the query string full request uri in
routes.rb?

I’d like to route requests for those going after my old application urls
to
my new rails application urls.

The old app used
/wiki.cgi?PageName
The rails app uses
/wiki/show/PageName

Like…
map.connect ‘wiki.cgi’, :controller => “wiki”, :action => “show”, :id
=>
ENV[‘QUERY_STRING’]

ENV doesn’t contain any CGI bits at all at the point routes.rb is
called.

env is invalid
request is invalid
params is invalid

What variables ARE valid at this point and do any of them contain what I
want?

No Apache solutions please.

Thanks.


J. Lambert


#2

Jon A. Lambert wrote:

Is there any way to access the query string full request uri in
routes.rb?

I’d like to route requests for those going after my old application urls
to
my new rails application urls.

The old app used
/wiki.cgi?PageName
The rails app uses
/wiki/show/PageName

Like…
map.connect ‘wiki.cgi’, :controller => “wiki”, :action => “show”, :id

J. Lambert

map.connect ‘wiki.cgi?:id’, :controller => “wiki”, :action => “show”,
:id => :id

The above should work, but it will still show wiki.cgi?PageName in the
browser. You could add an action to your wiki controller to redirect:
def redirect
redirect_to :controller => “wiki”, :action => “show”, :id =>
params[:id]
end

The the route would be:

map.connect ‘wiki.cgi?:id’, :controller => “wiki”, :action =>
“redirect”, :id => :id