REST adds many constraints. It restricts your controllers to seven actions. Normally this is okay, but sometimes you need to add your own custom actions. Learn how in this episode.
map.resources :tasks, :collection => { :completed => :get }, :member => { :complete => :put }
<!-- tasks/index.rhtml -->
<%= link_to "Mark as complete", complete_task_path(task), :method => :put %>
...
<%= link_to "Completed Tasks", completed_tasks_path %>
本文介绍如何在RESTful架构中添加自定义操作,通过Rails示例展示如何映射资源及其特定动作,如完成任务等。
846

被折叠的 条评论
为什么被折叠?



