Method: Scimitar::ActiveRecordBackedResourcesController#update

Defined in:
app/controllers/scimitar/active_record_backed_resources_controller.rb

#update(&block) ⇒ Object

PATCH (update)

Calls #save! on the updated record if no block is given, else invokes the block, passing the updated record which the block must persist, with the same rules as for #create.



103
104
105
106
107
108
109
110
111
112
# File 'app/controllers/scimitar/active_record_backed_resources_controller.rb', line 103

def update(&block)
  super do |record_id, patch_hash|
    self.storage_class().transaction do
      record = self.find_record(record_id)
      record.from_scim_patch!(patch_hash: patch_hash)
      self.save!(record, &block)
      record_to_scim(record)
    end
  end
end