REST in Rails: A Frustration

Back in 2007 Leonard Richardson & Sam Ruby wrote a book called RESTFUL
Web Services
(OReilley Media Inc.)

On page 173 they wrote:


These two resources, a list and an item in the list, show up all the
time. Every database table is a list that contains items. Anything that
can be represented as an RSS or Atom feed is a list that contains items.
Rails defines a RESTful architecture that makes a simplifying
assumption: every resource you expose can be made to fit one of these
two patterns. This makes things easy most of the time, but the cost is
aggravation when you try to use Rails controllers to expose resources
that don’t fit this simple model.


Has this changed? They wrote that paragraph for Rails 1.2 but I don’t
know Rails well enough to know if Rails can be RESTful with more complex
patterns.

Ralph S.

On Apr 15, 2012, at 12:10 PM, Ralph S. wrote:

Back in 2007 Leonard Richardson & Sam Ruby wrote a book called RESTFUL Web
Services
(OReilley Media Inc.)

On page 173 they wrote:


These two resources, a list and an item in the list, show up all the time. Every
database table is a list that contains items. Anything that can be represented as
an RSS or Atom feed is a list that contains items. Rails defines a RESTful
architecture that makes a simplifying assumption: every resource you expose can be
made to fit one of these two patterns. This makes things easy most of the time,
but the cost is aggravation when you try to use Rails controllers to expose
resources that don’t fit this simple model.


Has this changed? They wrote that paragraph for Rails 1.2 but I don’t know
Rails well enough to know if Rails can be RESTful with more complex patterns.

Do you have an example of what you mean by a more complex pattern? In my
experience, with the right controller methods and views, you can expose
almost anything as RSS. The cost is the coupling of your views to the
current state of the data.

Walter

Walter,

Sunday, April 15, 2012, 7:02:36 PM, you wrote:

WLD> On Apr 15, 2012, at 12:10 PM, Ralph S. wrote:

Back in 2007 Leonard Richardson & Sam Ruby wrote a book called RESTFUL Web
Services
(OReilley Media Inc.)

On page 173 they wrote:


These two resources, a list and an item in the list, show up all the time.
Every database table is a list that contains items. Anything that can be
represented as an RSS or Atom feed is a list that contains items. Rails defines a
RESTful architecture that makes a simplifying assumption: every resource you
expose can be made to fit one of these two patterns. This makes things easy most
of the time, but the cost is aggravation when you try to use Rails controllers to
expose resources that don’t fit this simple model.


Has this changed? They wrote that paragraph for Rails 1.2 but I don’t know
Rails well enough to know if Rails can be RESTful with more complex patterns.

WLD> Do you have an example of what you mean by a more complex pattern?
In my experience, with the right controller methods and views, you can
expose almost anything as RSS. The cost is the coupling of your views to
the current state of the data.

WLD> Walter

I don’t have and example. I’m still learning REST and Rails.

The authors of the book don’t say more about it. They presume, I
suppose, that the reader is familiar with Rails and understands all the
intricacies of REST.


Best regards,
Ralph mailto:[email protected]

On Apr 15, 2012, at 10:30 PM, Ralph S. wrote:

On page 173 they wrote:

I don’t have and example. I’m still learning REST and Rails.

The authors of the book don’t say more about it. They presume, I suppose, that
the reader is familiar with Rails and understands all the intricacies of REST.

I wouldn’t worry too much about it. Wait until you get into the weeds on
an actual project. I find that focuses the mind amazingly, and so far I
have not built a bridge too far. (I’m a recovering PHP user, myself.)
This list will be a tremendous help to you if you ask a specific
question, provide a precis of what you have tried so far, and error
messages if that’s what’s happening.

Walter