[英]configure restful routes in rails
I am trying to create a restful web service in a rails application. 我正在尝试在Rails应用程序中创建一个宁静的Web服务。 I need to configure a restful routes as below.
我需要如下配置一条宁静的路由。
localhost:3000/books/<book_name>/new/<parameters to create Book Item>
Eg: http://localhost:3000/books/sherlock/new/id/123/business/<BU>/.../{other parameters}
How do I configure it in the routes and access the params in controller. 如何在路由中配置它并访问控制器中的参数。 Please help.
请帮忙。
This technique is called "route globbing". 此技术称为“路由通配”。 http://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments
http://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments
However, if I were you - I'd used "default" query params. 但是,如果我是您-我会使用“默认”查询参数。 For many reasons.
出于很多原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.