看板 Ruby 關於我們 聯絡資訊
環境: Ruby 1.8.6 Rails 2.0.2 狀況: 請教一個路徑的問題 小弟想請教一個路徑問題 我執行了 step1 rails demo(在rails_apps下建立了demo資料夾) step2 cd demo step3 ruby script/server(可正確開啟) step4 ruby script/generate controller Say(建了一個叫Say的Controller) step5 然後更改一下了這個say_controller.rb檔 ============================================= class SayController<ApplicationController def hello(新增的) end(新增的) end ============================================= step 6 再去http://localhost:3000/Say/hello 但是在網頁端出現 Routing Error No route matches "/layouts" with {:method=>:get} 所以想問在http://localhost:3000/AAA/BBB AAA是指執行的controller BBB是action 那完全不用考慮目錄的路徑嗎? 例如,我建了demo資料夾 是不是應該要這樣(如下) http://localhost:3000/demo/Say/controller 還請前輩解釋一下囉~ 附錄:無 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 211.72.212.241
shelary:跟demo目錄無關..不須要加 /demo 01/23 14:40
whk:感謝,已解決,在http://blog.raienet.com/376找到答案 01/23 15:02
godfat:請參考 routes.rb 01/23 19:22