Method: Scimitar::ActiveRecordBackedResourcesController#replace
- Defined in:
- app/controllers/scimitar/active_record_backed_resources_controller.rb
#replace(&block) ⇒ Object
PUT (replace)
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.
86 87 88 89 90 91 92 93 94 95 |
# File 'app/controllers/scimitar/active_record_backed_resources_controller.rb', line 86 def replace(&block) super do |record_id, scim_resource| self.storage_class().transaction do record = self.find_record(record_id) record.from_scim!(scim_hash: scim_resource.as_json()) self.save!(record, &block) record_to_scim(record) end end end |