我運行軌道3.2.1和使用Rails的反應寶石可用3個應答以及閃光燈響應:https://github.com/plataformatec/responders與respond_with,需要一個塊使用應答
對於我的一些控制器動作我總是希望重定向回以前的網址,但如果在創建或不是對象顯示一個提示信息,它看起來是這樣的:
class MyController < ActionController::Base
responders :flash
respond_to :html
def create
@my_object = MyObject.create(params[:my_object])
respond_with @my_object do |format|
format.html { redirect_to :back }
end
end
end
這個作品在軌3.2.1不錯,但似乎已經停止在3.2工作。 2,似乎有一些修改關於如何respond_with功能,當一個塊。具體來說,這個補丁:https://github.com/rails/rails/pull/4870/files
我想知道是否有任何方法可以實現這種相同的行爲,並使用Flash Responder來設置Flash消息(我不想手動執行此操作)。
https://github.com/josevalim/inherited_resources/issues/213#issuecomment-4301657 – Ineu 2012-03-03 18:08:03