Trouble with a two-steps resource creation

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 Cicali

hi Claudio,

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 Mearelli

Ehi Luca,

That could work :slight_smile:

good

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

if you mean thetyper.com yes! :slight_smile:

Luca