通过 Rails 控制台获取当前路线的查看信息
我是里亚尔新手,我想通过 Rails 控制台找出特定路线正在使用哪个视图?
应用程序根据某些标准动态触发视图,并且此功能被我目前无法访问的 GEM 遮盖,因此尝试找出正在加载哪个视图(slim 或 erb)我目前所在的路线?
I'm new to Rials, and I'm trying to figure out which view is being used by a particular route, via the Rails console?
The application triggers view dynamically, based on certain criteria, and this functionality is obscured by a GEM which I don't have access to at this time, so trying to figure out which view (either a slim or an erb) is being loaded for the route I'm currently on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
打开项目文件夹上的终端并编写以下代码以查看具有相关控制器的所有路由。
注意:此代码不应在 Rails 控制台中运行。
但是,如果您可以访问应用程序控制台,您可以看到如下所示的视图部分。
例如第 5 行的 _working_hours 是由 get 请求触发的部分内容。
Open the terminal on the project folder and write the code below for see all routes with related controllers.
Note: This code should not be run in rails console.
However if you can access application console you can see view partials like below.
For example _working_hours at 5th line, is a partial from triggered by get request.