Ruby-on-rails 将一个控制器重定向到另一个控制器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11282846/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Redirect One Controller to another Controller
提问by Adnan
I have two controllers users & movies. All, I want to do, redirect from user#something to movie#something. is it possible??
我有两个控制器用户和电影。所有,我想做的,从用户#something 重定向到电影#something。是否可以??
采纳答案by Satya
回答by Peter Piper
redirect_to :controller => 'controllername', :action => 'actionname'
where controllername is the name of your controller and actionname is the name of your action. this works for rails 4 but should also work for older versions of rails
其中 controllername 是您的控制器的名称,actionname 是您的操作的名称。这适用于 rails 4,但也适用于旧版本的 rails

