这里我有两种控制器方法:Rails 2.3.5:flash [:notice]在redirect_to调用后消失
def invite
if request.post?
begin
email = AccountMailer.create_invite(@user,url)
AccountMailer.deliver(email)
flash[:notice] = "Invitation email sent to #{@user.email}"
rescue
#mail delivery failed
flash[:error] = "Failed to deliver invitation"
end
redirect_to :action => :show, :id => @user.id
end
end
和
def show
@title = "User #{@user.full_name}"
end
问题是,当我发送邀请并被重定向到./show时,我看不到任何消息。如果我将redirect_to更改为render,则会显示该消息。不过,闪存是否打算在随后的请求中工作?
BTW,我正在使用Rails + Passenger设置,是否可以将重定向的请求转到另一个应用程序实例?
当然是。 – xyzman 2010-05-20 07:39:48
事实上,我认为,如果在flash [:notice]之前发生救援,那么它将永远不会显示。 – Kezzer 2010-05-20 07:40:32