caelum / restfulie

CRUD through HTTP is a good step forward to using resources and becoming RESTful. Another step further into it is to make use of hypermedia-based services and the Restfulie gem allows you to do it very quickly.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

respond_to does not understand HTTP accept formats

fgrehm opened this issue · comments

The problem appeared after updating from 0.4 to 0.6 when requesting a resource from a xml representation.

  • Server response code: 406 - Not Acceptable
  • Client request accept header: application/xml
  • Controller's code

Firing up console and running "Restfulie.at('http://localhost:3000/orders/1').get" gives me back an Hashi::CustomHash object with resource's html representation. A solution proposed by Guilherme that fixed the problem for show action was to use render_resource instead of respond_to. I haven't updated the rest of controller's code to use render_created and render_collection to find out what happens.

Don't know if it helps but trying to fix the bug I've found out that commenting lines below this one makes respond_to work properly again.

This code does not exist any more.