Hey there, I''d like to set up my application so that, upon successfully creating a new user (within the users controller), that user is automatically logged in. So this is what I figured might work, but it doesn''t: <within users_controller.rb > --------------------------- def create @user = User.new(params[:user]) ... if @user.save ... redirect_to(:controller => ''sessions'', :action => ''create'', :login => @user.login, :password => @user.password) else ... end ----------------------------- I get an error to the tone of "non-existent action." Any ideas? Should I post my sessions_controller code? Thanks in advance, I hope I''ve provided enough info. Best, Jared
Marnen Laibow-Koser
2009-Sep-28 11:00 UTC
Re: Calling a controller action from another controller
jrgoodner wrote:> Hey there, I''d like to set up my application so that, upon > successfully creating a new user (within the users controller), that > user is automatically logged in. So this is what I figured might > work, but it doesn''t: > > <within users_controller.rb > > --------------------------- > def create > @user = User.new(params[:user]) > ... > if @user.save > ... > redirect_to(:controller => ''sessions'', :action => ''create'', :login > => @user.login, :password => @user.password) > else > ... > end > ----------------------------- > I get an error to the tone of "non-existent action."That should work, I think. Is create defined in SessionsController?> > Any ideas? Should I post my sessions_controller code? > > Thanks in advance, I hope I''ve provided enough info. > > Best, > JaredBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.