# Why use :new for own creation actions for restful resources

**URL:** <https://www.ruby-forum.com/t/why-use-new-for-own-creation-actions-for-restful-resources/91666>\
**Category:** Rails\
**Created:** [April 11, 2007, 10:16am UTC](https://www.ruby-forum.com/t/why-use-new-for-own-creation-actions-for-restful-resources/91666 "2007-04-11T10:16:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinlooker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/54ee81/32.png) [@martinlooker](https://www.ruby-forum.com/u/martinlooker)\
**Post date:** [April 11, 2007, 10:16am UTC](https://www.ruby-forum.com/t/why-use-new-for-own-creation-actions-for-restful-resources/91666/1 "2007-04-11T10:16:12Z")

</div>

In AWDWR, (pg415), it suggests using the following to allow the custom  
action to create a new resource:

map.resources :articles, :new =\> { :shortform =\> :post }

resulting in the following url method and path:

POST /articles/new;shortform

However having new in the url for a standard resource usually presents  
the form prior to creation at url:

GET /articles/new

and the posting of the creation actually takes place at the following  
URL:

POST /articles

So when adding a custom action to create a resource why not use:

map.resource :articles, :collection =\> { :shortform =\> :post }

which results in a url as follows that more closely matches the  
standard restful urls?

POST /articles;shortform

---

<div class="post-metadata">

**Author:** ![martinlooker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/54ee81/32.png) [@martinlooker](https://www.ruby-forum.com/u/martinlooker)\
**Post date:** [April 11, 2007, 2:51pm UTC](https://www.ruby-forum.com/t/why-use-new-for-own-creation-actions-for-restful-resources/91666/2 "2007-04-11T14:51:53Z")

</div>

GET “new” is used to show a form or otherwise give information on how to  
create an instance of the resource.

POST “create” is used to create the actual object.

Jason

---

<div class="post-metadata">

**Author:** ![martinlooker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/54ee81/32.png) [@martinlooker](https://www.ruby-forum.com/u/martinlooker)\
**Post date:** [April 12, 2007, 3:15pm UTC](https://www.ruby-forum.com/t/why-use-new-for-own-creation-actions-for-restful-resources/91666/3 "2007-04-12T15:15:27Z")

</div>

Jason, thanks for taking the time to reply.

I do understand the standard resource routing, however my question is  
about the ability to add additional custom actions to the standard  
ones. In particular I am puzzled that the examples of this in AWDWR on  
page 415 produce urls that do not conform in style to those produced  
by by the standard routing.
