Method: Rubydora::DigitalObject#save
- Defined in:
- lib/rubydora/digital_object.rb
#save ⇒ Rubydora::DigitalObject
persist the object to Fedora, either as a new object by modifing the existing object
also will save all ‘:changed?` datastreams that already exist new datastreams must be directly saved
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/rubydora/digital_object.rb', line 190 def save check_if_read_only mod_time = nil run_callbacks :save do if self.new? self.pid = repository.ingest to_api_params.merge(:pid => pid) @profile = nil #will cause a reload with updated data else p = to_api_params unless p.empty? mod_time = repository.modify_object p.merge(:pid => pid) clear_changes_information end end end mod_time = save_datastreams(mod_time) # mod_time will be nil on new objects with no ds changes unless mod_time.nil? self.lastModifiedDate = mod_time clear_attribute_changes(['lastModifiedDate']) end self end |