简体   繁体   English

如何将Rails应用程序的根路由到特定控制器?

[英]How can I route the root of a Rails app to a specific controller?

Right now I have a path that is 'localhost:3000/boards'. 现在,我的路径是“ localhost:3000 / boards”。 So for example 'boards/new', 'boards/1', etc. How can I route that all to root. 因此,例如“ boards / new”,“ boards / 1”等。如何将它们全部路由到root。 So I could just do 'localhost:3000/new', 'localhost:3000/1' and it would route to 'boards'? 所以我可以只执行'localhost:3000 / new','localhost:3000/1'并将其路由到'boards'吗?

Thanks! 谢谢!

尝试在config / routes.rb中使用resources :board, path: "/"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何用路由重命名Rails控制器? - How can I rename a Rails controller with a route? 在Ruby on Rails中,如何将控制器中的所有动作映射到root? - In Ruby on Rails, how can I map all actions in a controller to root? 如何在不带URL控制器的情况下创建到永久链接的Rails路由? - How can I create a Rails route to a permalink - without the controller in the URL? 我如何为多个 controller 导轨 6 布线方法 - How can i route a mothod for more than one controller rails 6 在 Rails 6 中,如何使用路由参数作为 controller 方法名称? - In Rails 6, how can I use a route parameter as the controller method name? 如何在nginx中部署多个rails应用程序,并在根目录中部署一个? - How can I deploy multiple rails app in nginx with one in the root? 如何在route.rb中将子域路由到Rails应用程序? - How can I route a subdomain to rails app in routes.rb? 在Ruby On Rails中,如何删除与特定控制器相关的视图 - In Ruby On Rails, how can I remove views related to a specific controller 如何覆盖特定控制器中的Rails会话存储? - How can I override the Rails session store in a specific controller? 在Rails中,如何路由移动根目录和非移动根目录? - How can I route a mobile root differently than a non-mobile one in Rails?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM