I have a philosophical question here. Say I have a website that uses two
models for accounts: Person and Company. Normally I would just have
/accounts/new for user signup.
However, the RESTful way to do it is to have /people and /companies.
Unfortunately, this doesn’t account for a situation where you’d have a
one-page signup form. I wouldn’t want this to be a two page process,
because somebody could close their browser mid-process and that would
leave me with an incomplete account with only a Company or Person entry.
How would you all solve this in a RESTful way?
I am strongly considering adopting REST for most of my projects, but I
can’t decide how I want to solve this.
I have a philosophical question here. Say I have a website that uses two
models for accounts: Person and Company. Normally I would just have
/accounts/new for user signup.
I asked DHH this same question on his blog comments - http://www.loudthinking.com/arc/000593.html - and he said that an
additional controller, e.g. signup, with a create action was his own
solution.
To see his answer, search for “signup” on that page.
I’m just wondering.
Are you planning to provide external software to create accounts? Why
are you doing this using REST? It just seems to me like you are making
things more complex and unnatural just because DHH says it’s the way.
Love the guy but I don’t see why adopting REST for everything in every
project can actually lead to better looking code.
Normally I would just have
/accounts/new for user signup.
Thats exactly what rest wants you to do. Accessing ideas or concepts
with limited verbs is what is important. If you come up with a concept
that encapsulates a million different tables in your database it would
still be just fine to expose that in a url (have a controller for that
idea). The only thing you really need to watch out for is crazy verbs.
Not crazy abstract ideas, they’re fine (even encouraged!). As long as
you don’t stray from the regular list, show, edit, new, etc. actions in
your controllers you are probably doing a good job keeping things
restful.
Thats at least my take.
Raymond L. wrote:
Hey everyone,
I have a philosophical question here. Say I have a website that uses two
models for accounts: Person and Company. Normally I would just have
/accounts/new for user signup.
However, the RESTful way to do it is to have /people and /companies.
Unfortunately, this doesn’t account for a situation where you’d have a
one-page signup form. I wouldn’t want this to be a two page process,
because somebody could close their browser mid-process and that would
leave me with an incomplete account with only a Company or Person entry.
How would you all solve this in a RESTful way?
I am strongly considering adopting REST for most of my projects, but I
can’t decide how I want to solve this.
I’m just wondering.
Are you planning to provide external software to create accounts? Why
are you doing this using REST? It just seems to me like you are making
things more complex and unnatural just because DHH says it’s the way.
Love the guy but I don’t see why adopting REST for everything in every
project can actually lead to better looking code.
Considering that less code is better looking code, I’d say REST leads to
better
looking code