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

Ruby one minute tutorial problem

rurounijones opened this issue · comments

I have just gone through the ruby one minute tutorial at https://github.com/caelum/restfulie/wiki/ruby_one_minute but there appears to be unexpected results.

According to the page, after un-marshalling the response I should have an array of companies that I can find the details of using, for example

items = response.resource
puts items.size
puts items[0].name

What I am actually getting is a Hash which contains another hash which contains the actual items so I have to use the following

items = response.resource
items.items.item[0].name

I assume this is not correct behaviour? Or is the tutorial out of date or something else has gone screwy? using restfulie 1.0.0 on ruby 1.8.7 with rails 3.0.5