Ruby on rails 轨道3和x27;使用重定向时无法工作

Ruby on rails 轨道3和x27;使用重定向时无法工作,ruby-on-rails,session,authlogic,Ruby On Rails,Session,Authlogic,我有一些代码,我有一个:注意,这只是选择性地出现 这是密码 respond_to do |format| if @userhj.save format.html { redirect_to(:action => :index, :notice => 'Succesfully assigned job') } format.xml { render :xml => @userhj, :status => :created, :location =>

我有一些代码,我有一个:注意,这只是选择性地出现

这是密码

respond_to do |format|
  if @userhj.save
    format.html { redirect_to(:action => :index, :notice => 'Succesfully assigned job') }
    format.xml  { render :xml => @userhj, :status => :created, :location => @userhj }
  else
    format.html { redirect_to(:root, :notice => 'Duplicate job assignment') }
    format.xml  { render :xml => @user.errors, :status => :unprocessable_entity }
  end
end
从:index视图重定向到:index时,通知不会正确显示。看看Firebug的网络控制台,有一个GET(在这里插入url)?notice=(通知文本),当通知正确显示时,它不会出现在其他页面中


我使用的是authlogic,只是basic,使用本教程进行设置。我很感激你能帮我做这件事。谢谢

我猜Ruby认为
:注意
是url属性的一部分,而不是options属性。试试这个:

redirect_to({:action => :index}, {:notice => 'Succesfully assigned job'})

哦,哇,那太好了!不能告诉你这让我有多疯狂!谢谢谢谢我必须同时传递一个额外的参数和通知。在找到你的答案之前,我无法让它工作。将_重定向到({:controller=>'sales',:action=>'new',:linked_id=>@purchase.id},{:notice=>'notice.})