Hi --
I'm still trying to make restful desing click in my head. Yesterday I asked about <a href="http://www.ruby-forum.com/topic/101827">good examples apps to learn from</a>, and there don't appear to be very many. And most of the examples that do exist seem to be fairly strait forward mappings to rest concepts... posts and comments and such.
So I'd like to see some more examples, and in particular I think it would be fun to turn the "Depot" store app from AWDR into a more restful example. For me it would be a nice example because fairly simple and clean and it's not quite clear to me how a restful desing would be added.
Two sets of questsion to get me started.
1. Does this seems like a useful thing to do? Would anyone learning restful design out there like to see this, and for people who already get it is the Depot app a good candidate?
I think it could be quite worthwhile.
2. And second does anyone have design tips that I should use to get started? So far this is what I've done.
- used the restful_authentication plugin to generate an authentication system. - used scaffold_resource to generate resources to model the store:
- products - carts - cart_items - orders - order_items
I'd recommend trying a slightly different approach. (I don't use scaffolding at all, but that's not my focus here.) In my book, I develop a store application, and one of the things I realized early on was that I didn't want or need a shopping cart model. The shopping cart was really a virtual thing; it was essentially a view of a collection of orders.
I've thought about what I'd do if I were to rewrite that very application to use the new REST support. I would still not have a cart model. But I would have a cart controller, and I would do:
map.resources :cart
(or some nested variant thereof). In my original application, I had actions like customer#view_cart. That could be turned into cart#show.
It's a good example of a case where the whole controller/model stack is probably too much. The idea of a shopping cart resource need not be wired to a shopping cart model. You can still leverage the full range of named routes and abstraction that the REST techniques give you.
Anyway -- it's something to think about.
David