Rails Restfull Resource + Examples

Missing from the standard Routes table Mappings is an example of what these actions look like within a page.


Verb Path Action Helper Example

GET /orders index orders_url <a href="/orders">Back</a>

GET /orders/:id show order_url <a href="/orders/1">Show</a>

GET /orders/new new new_order_url <a href="/orders/new">New</a>

POST /orders create orders_url <form method="post" id="new_order" class="new_order" action="/orders">

GET /orders/:id/edit edit edit_order_url <a href="/orders/1/edit">Edit</a>

PUT /orders/:id update order_url
 <form method="post" id="edit_order_3" class="edit_order" action="/orders/3">
 <input type="hidden" value="put" name="_method">

DELETE /orders/:id destroy order_url <a rel="nofollow" data-method="delete" data-confirm="Are you sure?" href="/orders/3">Destroy</a>
Comments