708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
|
# File 'lib/jsonapi/request_parser.rb', line 708
def parse_remove_relationship_operation(resource_klass, params, relationship, parent_key)
operation_base_args = [resource_klass].push(
context: @context,
resource_id: parent_key,
relationship_type: relationship.name
)
if relationship.is_a?(JSONAPI::Relationship::ToMany)
operation_args = operation_base_args.dup
keys = params[:to_many].values[0]
operation_args[1] = operation_args[1].merge(associated_keys: keys)
JSONAPI::Operation.new(:remove_to_many_relationships, *operation_args)
else
JSONAPI::Operation.new(:remove_to_one_relationship, *operation_base_args)
end
end
|