sorry, because it seems that I need more explanation on this Rails Recipes authorization - I finally got the code working but after using the login I get this back from Rails- Routing Error No url can be generated for the hash {} I''m guessing it''s coming from the redirect- def login if request.post? session[:user] = User.authenticate(params[:first_name], params[:last_name], params[:password]).id redirect_to :action => session[:intended_action], :controller => session[:intended_controller] I don''t see an explanation in the recipe about this redirect. Do I need it ? TIA Stuart
You could do something like... if session[:intended_action] && session[:intended_controller] redirect_to :action => session[:intended_action], :controller => session[:intended_controller] else redirect_to :action => ''index'' end Your authorize before_filter is not setting those values into the session before redirecting user to the login controller. What does your before_filter look like?
I have a before filter - before_filter :check_authentication def check_authentication unless session[:user] session[:intended_action] = action_name session[:intended_controller] = controller_name redirect_to :action => "signin" end end The main index will be where users can login or register. However after logging in they should be returned to the main index with a greeting for them and the register and login box gone. Stuart On 8/7/06, Jim Lindley <jimlindley@gmail.com> wrote:> You could do something like... > > if session[:intended_action] && session[:intended_controller] > redirect_to :action => session[:intended_action], > :controller => session[:intended_controller] > else > redirect_to :action => ''index'' > end > > Your authorize before_filter is not setting those values into the > session before redirecting user to the login controller. What does > your before_filter look like? > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >