在Rails控制器混錯我打電話這樣的:redirect_to的和:控制器:動作Rails中
redirect_to :controller => "user", :action => "login"
我user_controller.rb
定義了以下方法:
class UserController < ApplicationController
def login
###
end
當我打電話給我redirect_to
方法我得到了我的瀏覽器這個錯誤:No action responded to show.
檢查服務器日誌我看到這一行:
Processing UserController#show (for 127.0.0.1 at 2009-12-19 12:11:53) [GET]
Parameters: {"action"=>"show", "id"=>"login", "controller"=>"user"}
最後,我有這行我routes.rb
map.resources :user
任何想法,我做錯了嗎?
+1,但我不認爲這是什麼大不了的打破寧靜的範例。宇宙包含4個以上的動詞。 :-) – MattMcKnight 2009-12-19 18:42:00
我想,我的答案在功能上與此相同。謝謝你的幫助。 – kubi 2009-12-21 12:00:39