apotonick/roar-rails — pull request #19 by cowboyd (2012-06-30 02:48:17+00:00)
Title: Don't represent empty responses

Rails 3.1 and below erroneously call `#display`
for HTTP requests which are guaranteed to have an
empty body (PUT, DELETE). Instead of passing the
resource specified in `respond_with` it passes
the empty resource (in the case of json, '{}') to
`#display` as a string.

This causes roar-rails to complain that there is
no StringRepresenter. Add a check to to make sure
that we aren't handed the empty resource before
attempting to represent.

This check is not a slow down in Rails 3.2 and
greater because the `#display` method is never
called for PUT and DELETE

As a pre-requisite for this, I had to fix a bug where
controllers were sharing instances of
represents_options