Forum: Ruby on Rails REST Design

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
5d7065cd56d6c82d5bc08735f9fadd90?d=identicon&s=25 Lza (Guest)
on 2007-05-28 21:56
(Received via mailing list)
I am trying to design an application using a REST style, however, I am
unsure of the correct way to handle a page which has multiple
resources being displayed, such as hotel rooms and advertisements; or
a page that displays the most recent items from a collection and also
the least recent. Does anyone have any idea how I would go about doing
this, or any suggestions of where I can go to find more information on
this particular issue?

588ab1c0a5610a7e160a3b101abb91e6?d=identicon&s=25 MichaelLatta (Guest)
on 2007-05-28 23:28
(Received via mailing list)
There are many opinions I am sure.  I would say that REST is more
about information than presentation.  More about services to be put
together than monolithic web pages.

Using that perspective a web page that wants to present several
resources should access the resources individually as separate
components.  Rails has not gotten to the point where this is well
supported however.  There is some support in edge for nested
resources, but the last I heard it was not yet stable.  Using that
model you would have resources for the composite view and for each
component resources.

But, basically unless you are presenting very simple information
presentations REST is less about the browser and more about
information access by other programs.  So while your web page may be
at /summary/something you may make each piece available separately as
well.  /rooms /advertisements /items/recent and /items/old or

What REST does advocate is that there are a limited number of
operations GET, PUT, POST, DELETE and a URI used to obtain a resource
should be used in a PUT to update the resources, and in DELETE to
delete the resource.  So if you have a web page that shows rooms and
advertisements, and a teaser of recent news items, you should be able
to delete all of them with a DELETE request to the same URI
(right? :-))  Obviously this is not true.  Web pages are presentation,
and need to be treated a bit different than services.

5d7065cd56d6c82d5bc08735f9fadd90?d=identicon&s=25 Lza (Guest)
on 2007-05-29 00:21
(Received via mailing list)
Thank you for your response. Just a few comments.

So am I correct in saying that this situation suggests that I should
develop the web application in a more RPC style way, being that REST
will not support returning multiple resources? Therefore I should save
any REST style interactions for when there is a single resource I am
returning that I want to expose as a service?

Nested resources seem as if they would only allow me to nest one child
element, any idea what would happen when I have multiple children on a

Are there any other opinions out there on this?
This topic is locked and can not be replied to.