Alexandre Hudelot
2006-Aug-01 18:51 UTC
[Rails] How to retrieve :web when redirecting to an Instiki page?
Hello, I am currently working on implementing some authentification code
onto Instiki (0.11.0). I am encountering a problem in this situation :
When I try to access say http:/localhost:2500/orz/show/Test , where orz
is an instiki web name, I am redirected to my signin form screen (which
is what I want) but then upon signing in I get the following message:
No url can be generated for the hash {:controller=>"wiki",
:action=>"show", :id=>"Test"}
Now if I then type in http:/localhost:2500/orz/show/Test in my browser
addressline I can access the page without any problem. So there seems to
be a problem with the redirection in my signin method, which looks like
this:
def signin
ession[:user] = User.authenticate(params[:username],
params[:password]).id
redirect_to :web=> session[:intended_web],
:controller => session[:intended_controller],
:action => session[:intended_action],
:id => session[:intended_id]
end
I realize that session[:intended_web] is a naive attempt and returns nil
since that session variable doesn''t exist, so how should I go about
retrieving the intended web''s name upon signin redirection?
(Of course if there is a single web and I set DEFAULT_WEB to the web''s
name, as well as setting :web=> DEFAULT_WEB in the signin method, there
ceases to be a problem, but I would like a solution that works with
multiple webs.)
Any help is very appreciated.
--
Posted via http://www.ruby-forum.com/.
