Rails 2.3.5: flash[:notice] disappears after redirect_to call
- by xyzman
Here I've got two controller methods:
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
and
def show
@title = "User #{@user.full_name}"
end
The problem is, when I send an invitation, and get redirected to ./show, I see no messages at all. If I change redirect_to to render, the message appears. Still, isn't it intended for flash to work in the immediate subsequent requests?
BTW, I'm using Rails+Passenger setup, could it be so that redirected request goes to another application instance?