Ruby on rails Rails是否应该重定向_以发送html?

Ruby on rails Rails是否应该重定向_以发送html?,ruby-on-rails,redirecttoaction,Ruby On Rails,Redirecttoaction,在大多数框架中,发送重定向意味着设置HTTP头并退出,而不将任何HTML数据发送回浏览器。但是,使用Firebug,我发现Rails并没有遵循这个约定: def update @phone_number = PhoneNumber.find(params[:id]) if @phone_number.update_attributes(params[:phone_number]) flash[:notice] = "Successfully updated phone

在大多数框架中,发送重定向意味着设置HTTP头并退出,而不将任何HTML数据发送回浏览器。但是,使用Firebug,我发现Rails并没有遵循这个约定:

def update
    @phone_number = PhoneNumber.find(params[:id])
    if @phone_number.update_attributes(params[:phone_number])
      flash[:notice] = "Successfully updated phone number."
      redirect_to @phone_number
    else
      render :action => 'edit'
    end
end
作为响应,标题具有:

Connection  close
Date        Tue, 27 Oct 2009 06:17:00 GMT
X-Runtime    28
Location      http://localhost:3000/phone_numbers/1999521184
它还有两次显示动作的结果


知道为什么吗?

很有趣。看来萤火虫在骗我。使用WireShark,我确认它实际上并没有发送页面数据,只是重定向和一条基本的“You is redirected”消息。看起来像是带firebug的bug。

可能是带firebug的bug。还有一件事可以尝试:

redirect_to @phone_number and return