这段话有问题吗?
在看Ralf Wirdemann 和Thomas Baustert的《RESTful Rails Development》,1.2节的why REST的时候说道:
Clean URLs. REST URLs represent resources and not actions. URLs always have the
same format: first comes the controller and then the id of the referenced esource.
The requested manipulation is independent of the URL and is expressed with the help of HTTP verbs.
说REST有着清楚简洁的URL风格,URL里不表示(带)action,是controller/:id这样形式的,至于对这个资源进行何种操作,是通过http header里的动词来指定的。
我是对这句话很有疑问,http header 里就4中操作,如果处理CRUD以外的action的话,怎么办?
Map.resources 的时候可以指定collection或者member的action,就是说url里还是会出现action的,比如users;top10,可以列出排名前十的用户,这个top10就是collection指定的users控制器的一个action。
这句话说的即使不错,也是不严谨的。对于刚接触REST这个词的人来说,很容易误解,误入歧途。
我觉得,不是说/projects/1就比/projects/show/1更RESTful了。
本来,URL就是RESTful的东西。