lib/hyper_resource/adapter/hal_json.rb in hyperresource-0.9.1 vs lib/hyper_resource/adapter/hal_json.rb in hyperresource-0.9.2
- old
+ new
@@ -42,18 +42,20 @@
return unless resp['_embedded']
objs = rsrc.objects
resp['_embedded'].each do |name, collection|
if collection.is_a? Hash
+ href = collection['_links']['self']['href'] rescue nil
objs[name] =
rsrc.new_from(:resource => rsrc,
:body => collection,
- :href => collection['_links']['self']['href'] )
+ :href => href)
else
objs[name] = collection.map do |obj|
+ href = obj['_links']['self']['href'] rescue nil
rsrc.new_from(:resource => rsrc,
:body => obj,
- :href => obj['_links']['self']['href'] )
+ :href => href)
end
end
end
end