在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