我試圖提供一個自定義的404響應在rails中,但我不知道如何給:respond_with
函數的狀態。使用respond_with服務404?
我知道有render
,我可以做這樣的事情:
render :status => :not_found, :json => {:response =>"There weren't any results"}
我怎麼可以做這樣的事情與respond_with
?有沒有辦法用respond_with
設置狀態碼?
我使用respond_with
的唯一原因是,據我的理解,當您開始使用respond_to
時,使用respond_with
是正確的協議。如果這是不正確的,我應該使用render
,請讓我知道!
對不起。我不確定我錯過了你的答案。非常感謝!那很完美。不幸的是,我是ruby的新手,我在文檔中尋找'respond_with'而不是'Responder'。這正是我需要的。 – RileyE 2013-03-06 15:38:58