Calling a controller action from another controller

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:

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

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:

--------------------------- 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,
Jared

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]