RafaĆ Komorowski
2005-Nov-04  00:29 UTC
Controller modules and session parameters - a bug or my fault?
I''m using the concept of controller modules, as described in the  
"Agile Web Dev..." book on page 190-191, so I can have urls like
''/
admin/:controller/:action/:id'' along with
''/:controller/:action/:id''.
Also, I''m using this
	session[:jumpto] = request.parameters
trick, to trace back from some of edit/update type of pages that are  
linked from several places (described on page 137).
It''s works fine for the ''/:controller/:action/:id''
type of urls, but
fails for ''/admin/:controller/:action/:id'' redirecting to non-
existent ''/admin/admin/...'' urls.
The Dave''s & David''s book says (page 298), that when you
pass
a :controller name starting with a ''/'' then that name is
absolute and
should contain a module''s name (so
''/admin/task/edit/24'' works always
okay). But apparently ''request.parameters'' object returns a  
controller name without starting slash, but with a module name (if  
present), so my ''session[:jumpto]'' gets
''admin/task''. When I pass
this value to the ''redirect_to'' method then the current module
context is added (''/admin/''), resulting in bad url
''/admin/admin/...''.
Of course the quick hack is to use this:
     session[:jumpto] = request.parameters
     session[:jumpto][:controller] = ''/'' +
session[:jumpto][:controller]
but I wonder if the behaviour of ''request.parameters'' is not a
bug?
What do you think?
If that matters, I''m using a Locomotive with Rails 0.14.1 and  
Lighttpd 1.4.6 + FastCGI 2.4.0 on Mac OS X 10.4.
-- 
Rafal Komorowski
komor-ee4meeAH724@public.gmane.org