I'm used to ruby with params[:type]'
when trying to grab ?type=this
but is there a way to get page
from http://localhost:3000/admin/test/page
? Perhaps with a params[0]
or something similar? Just need the name of the directory after test..
当我试图抓住时,我习惯用params [:type]'来打字吗?type = this但是有没有办法从http:// localhost:3000 / admin / test / page获取页面?也许有一个params [0]或类似的东西?测试后只需要目录的名称..
2 个解决方案
#1
2
request.url
and play with ruby to strip everything but the page. Or you can define admin/test/:id
in your routes.rb and manage the id within the controller.
request.url和ruby一起玩除了页面之外的一切。或者您可以在routes.rb中定义admin / test /:id并管理控制器中的id。
#2
1
The /page will route to your method. So you should know what it is already.
/页面将路由到您的方法。所以你应该知道它已经是什么了。
#1
2
request.url
and play with ruby to strip everything but the page. Or you can define admin/test/:id
in your routes.rb and manage the id within the controller.
request.url和ruby一起玩除了页面之外的一切。或者您可以在routes.rb中定义admin / test /:id并管理控制器中的id。
#2
1
The /page will route to your method. So you should know what it is already.
/页面将路由到您的方法。所以你应该知道它已经是什么了。