# Trouble with a two-steps resource creation

**URL:** <https://www.ruby-forum.com/t/trouble-with-a-two-steps-resource-creation/103478>\
**Category:** Rails\
**Created:** [May 6, 2007, 7:51pm UTC](https://www.ruby-forum.com/t/trouble-with-a-two-steps-resource-creation/103478 "2007-05-06T19:51:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![claxo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b9e5f3/32.png) [@claxo](https://www.ruby-forum.com/u/claxo)\
**Post date:** [May 6, 2007, 7:51pm UTC](https://www.ruby-forum.com/t/trouble-with-a-two-steps-resource-creation/103478/1 "2007-05-06T19:51:00Z")

</div>

Hello,

I’m having some troubles figuring how a REST two-step creation process  
for  
a resource could take place. The resource is also nested.

I have Projects that may have Contributions.

So here is the routes:

map.resources :projects do |projects|  
projects.resources :contributions, :name\_prefix =\> ‘project\_’  
end

Adding contribution is a two-steps (two forms) process: first some data,  
then something other… something like an wizard, you know.

There are no problems, of course, on the first new/create RESTful  
step… but what have I to do to remain REST, but to proceed to  
step number two?

Something like projects/20/contributions/new;step1 and  
projects/20/contributions/new;step2?

Thank you

Claudio C.

---

<div class="post-metadata">

**Author:** ![claxo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b9e5f3/32.png) [@claxo](https://www.ruby-forum.com/u/claxo)\
**Post date:** [May 7, 2007, 7:06am UTC](https://www.ruby-forum.com/t/trouble-with-a-two-steps-resource-creation/103478/2 "2007-05-07T07:06:45Z")

</div>

hi Claudio,

2007/5/6, Claudio C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I’m having some troubles figuring how a REST two-step creation process for  
> a resource could take place. The resource is also nested.

…

Adding contribution is a two-steps (two forms) process: first some data,

> then something other… something like an wizard, you know.

How are the two steps supposed to work?  
Does the first step result in creating the object (in the db) and the  
second  
setting the remaining attributes?  
If yes, then it just maps naturally in a first step which posts the new  
object and a second step that puts the remaining data (i.e. a create+an  
update)

Otherwise it’s justa matter of splitting the single “new object” form in  
two  
and therefore i feel the following is correct:

Something like projects/20/contributions/new;step1 and

> projects/20/contributions/new;step2?

Hope that helps…

Luca M.

---

<div class="post-metadata">

**Author:** ![claxo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b9e5f3/32.png) [@claxo](https://www.ruby-forum.com/u/claxo)\
**Post date:** [May 7, 2007, 2:26pm UTC](https://www.ruby-forum.com/t/trouble-with-a-two-steps-resource-creation/103478/3 "2007-05-07T14:26:02Z")

</div>

2007/5/7, Claudio C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> That could work 🙂

good

Thank you! (are you the guy behind thewriter? If so, very nice work!)

> 

if you mean [thetyper.com](http://thetyper.com) yes! 🙂

Luca

---

<div class="post-metadata">

**Author:** ![claxo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b9e5f3/32.png) [@claxo](https://www.ruby-forum.com/u/claxo)\
**Post date:** [May 7, 2007, 1:45pm UTC](https://www.ruby-forum.com/t/trouble-with-a-two-steps-resource-creation/103478/4 "2007-05-07T13:45:59Z")

</div>

Ehi Luca,

On 07/05/07, Luca M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> …  
> update)

Yeah right… I’d had figured it out already… a new and an update.

That could work 🙂

Thank you! (are you the guy behind thewriter? If so, very nice work!)
