Method: JSONAPI::Processor#replace_to_many_relationship

Defined in:
lib/jsonapi/processor.rb

#replace_to_many_relationshipObject



254
255
256
257
258
259
260
261
262
263
# File 'lib/jsonapi/processor.rb', line 254

def replace_to_many_relationship
  resource_id = params[:resource_id]
  relationship_type = params[:relationship_type].to_sym
  data = params.fetch(:data)

  resource = resource_klass.find_by_key(resource_id, context: context)
  result = resource.replace_to_many_links(relationship_type, data)

  return JSONAPI::OperationResult.new(result == :completed ? :no_content : :accepted)
end