看板 Ruby 關於我們 聯絡資訊
請問一下 我在rails的controller中建立了一個post的action 但是我透過javascript或是fiddler中的composer對他發送 都會收到status 422 我試著用 scaffold 產生的表單對rails送 並且使用fiddler觀察了他的封包 發現他送出的body中 除了我的資訊之外還夾帶者其他的東西 如 authenticity_token 與 commit 等 請問如果我要使用javascript(或jquery)送該如何做 又或者我能不能單純一點 指定這個action只要接受單純的post 不要檢查這些東西 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.250.14.178 ※ 文章網址: http://www.ptt.cc/bbs/Ruby/M.1413342777.A.A29.html
mars90226: 感覺有點不太清楚,有沒有傳送的封包長相 10/15 12:33
mars90226: 你javascript是怎麼寫的? 10/15 12:34
ireullin: http://ppt.cc/0zdN 10/15 13:25
ireullin: 這是我用fiddler送的一個空白的post 10/15 13:25
mars90226: 縮圖太小了,看不到... 10/15 17:25
ireullin: http://ppt.cc/S~0R 10/15 18:03
ireullin: http://ppt.cc/pIsJ 10/15 18:04
ireullin: 抱歉~~我將圖切開了 10/15 18:04
mars90226: 你可以用 http://pastebin.com/ 之類的網站把訊息都貼 10/15 21:43
mars90226: 上來,會比較清楚,然後我猜你沒有注意到strong parame 10/15 21:44
mars90226: parameter,所以被擋下來? 10/15 21:44
ihower: skip_before_filter :verify_authenticity_token 10/16 21:58
ihower: 或 skip_before_action :verify_authenticity_token 10/16 21:59
ireullin: 謝謝喔,我用skip_before_filter的方式解決了 10/18 17:20