1. 程式人生 > >render & redirect_to

render & redirect_to

1、render 和 redirect_to

render  :action =>  'XXX'     #只是尋找"XXX"該頁面,並不執行其對應的action.不會向瀏覽器傳送新的請求,仍然可以使用當前請求的引數和變數

redirect_to  :action => 'XXX'   #即向瀏覽器傳送一個新的請求,跳轉到該action

2、 config/routes.rb

如果在 controller AAA中新建了一個action BBB,但  http://localhost:3000/AAA/BBB 卻報錯Couldn 't find AAA with ID=BBB

開啟config/routes.rb 檔案新增url路徑





相關推薦

no