lib/hyper_resource/adapter/hal_json.rb in hyperresource-0.1.9.3 vs lib/hyper_resource/adapter/hal_json.rb in hyperresource-0.1.9.4
- old
+ new
@@ -1,5 +1,6 @@
+require 'rubygems' if RUBY_VERSION[0..2] == '1.8'
require 'json'
class HyperResource
class Adapter
class HAL_JSON < Adapter
@@ -38,15 +39,15 @@
rsrc.objects = rc::Objects.new(rsrc)
objs = rsrc.objects
resp['_embedded'].each do |name, collection|
if collection.is_a? Hash
- r = rc.new
+ r = rc.new(:root => rsrc.root, :namespace => rsrc.namespace)
r.response_object = collection
objs[name] = apply(collection, r)
else
objs[name] = collection.map do |obj|
- r = rc.new
+ r = rc.new(:root => rsrc.root, :namespace => rsrc.namespace)
r.response_object = obj
apply(obj, r)
end
end
end