attempt_login提交登录表单后,使用Ajax调用以下方法.
class AccessController < ApplicationController
[...]
def attempt_login
authorized_user = User.authenticate(params[:username], params[:password])
if authorized_user
session[:user_id] = authorized_user.id
session[:username] = authorized_user.username
flash[:notice] = "Hello #{authorized_user.name}."
redirect_to(:controller => 'jobs', :action => 'index')
else
[...]
end
end
end
Run Code Online (Sandbox Code Playgroud)
问题是redirect_to不起作用.
你怎么解决这个问题?