lib/hyper_resource/adapter/hal_json.rb in hyperresource-0.2.2 vs lib/hyper_resource/adapter/hal_json.rb in hyperresource-0.2.3
- old
+ new
@@ -44,16 +44,20 @@
rsrc.objects = rc::Objects.new(rsrc)
objs = rsrc.objects
resp['_embedded'].each do |name, collection|
if collection.is_a? Hash
- r = rc.new(:root => rsrc.root, :namespace => rsrc.namespace)
+ r = rc.new(:root => rsrc.root,
+ :headers => rsrc.headers,
+ :namespace => rsrc.namespace)
r.body = collection
objs[name] = apply(collection, r)
else
objs[name] = collection.map do |obj|
- r = rc.new(:root => rsrc.root, :namespace => rsrc.namespace)
+ r = rc.new(:root => rsrc.root,
+ :headers => rsrc.headers,
+ :namespace => rsrc.namespace)
r.body = obj
apply(obj, r)
end
end
end
@@ -99,9 +103,10 @@
filtered_attrs.keys.each do |attr|
rsrc.attributes[attr] = filtered_attrs[attr]
end
+ rsrc.attributes._hr_clear_changed
rsrc.attributes._hr_create_methods!
end
end
end