7
Rails 3:如何在Ajax调用中“ redirect_to”?
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 问题是那redirect_to行不通。 您将如何解决?