Class: Frigg::Persister
- Inherits:
-
Valkyrie::Persistence::Fedora::Persister
- Object
- Valkyrie::Persistence::Fedora::Persister
- Frigg::Persister
- Defined in:
- lib/frigg/persister.rb
Overview
Persister for Postgres MetadataAdapter.
Instance Method Summary collapse
-
#save(resource:, external_resource: false, perform_af_validation: false) ⇒ Valkyrie::Resource
Persists a resource within the database.
Instance Method Details
#save(resource:, external_resource: false, perform_af_validation: false) ⇒ Valkyrie::Resource
Persists a resource within the database
Modified from the upstream to skip previously persisted check
rubocop:disable Lint/UnusedMethodArgument
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/frigg/persister.rb', line 15 def save(resource:, external_resource: false, perform_af_validation: false) # TODO # orm_object = resource_factory.from_resource(resource: resource) # orm_object.transaction do # orm_object.save! # if resource.id && resource.id.to_s != orm_object.id # raise Valkyrie::Persistence::UnsupportedDatatype, # "Postgres' primary key column can not save with the given ID #{resource.id}. " \ # "To avoid this error, set the ID to be nil via `resource.id = nil` before you save it. \n" \ # "Called from #{Gem.location_of_caller.join(':')}" # end # end # resource_factory.to_resource(object: orm_object) # rescue ActiveRecord::StaleObjectError # raise Valkyrie::Persistence::StaleObjectError, "The object #{resource.id} has been updated by another process." end |