lib/jsonapionify/api/relationship/many.rb in jsonapionify-0.9.2 vs lib/jsonapionify/api/relationship/many.rb in jsonapionify-0.9.3
- old
+ new
@@ -28,12 +28,10 @@
cacheable: false,
prepend: 'relationships',
example_input: :resource_identifier
}
define_action(:replace, 'PATCH', **options, &block).response status: 200 do |context|
- context.owner_context.reset(:instance)
- context.reset(:collection)
context.response_object[:data] = build_identifier_collection(context.collection)
context.response_object.to_json
end
end
@@ -44,12 +42,10 @@
cacheable: false,
prepend: 'relationships',
example_input: :resource_identifier
}
define_action(:add, 'POST', **options, &block).response status: 200 do |context|
- context.owner_context.reset(:instance)
- context.reset(:collection)
context.response_object[:data] = build_identifier_collection(context.collection)
context.response_object.to_json
end
end
@@ -61,18 +57,16 @@
prepend: 'relationships',
example_input: :resource_identifier
}
options[:prepend] = 'relationships'
define_action(:remove, 'DELETE', **options, &block).response status: 200 do |context|
- context.owner_context.reset(:instance)
- context.reset(:collection)
context.response_object[:data] = build_identifier_collection(context.collection)
context.response_object.to_json
end
end
context :scope do |context|
- instance_exec rel.name, context.owner, context, &rel.resolve
+ instance_exec(rel.name, context.owner, context, &rel.resolve).dup
end
show
end
end