這裏我有兩種控制器方法: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