lib/hyrax/transactions/steps/save.rb in hyrax-5.0.0.rc2 vs lib/hyrax/transactions/steps/save.rb in hyrax-5.0.0.rc3
- old
+ new
@@ -38,11 +38,11 @@
unsaved = change_set.sync
save_lease_or_embargo(unsaved)
saved = @persister.save(resource: unsaved)
rescue StandardError => err
- return Failure(["Failed save on #{change_set}\n\t#{err.message}", change_set.resource])
+ return Failure.new(["Failed save on #{change_set}\n\t#{err.message}", change_set.resource], err.backtrace.first)
end
# if we have a permission manager, it's acting as a local cache of another resource.
# we want to resync changes that we had in progress so we can persist them later.
saved.permission_manager.acl.permissions = unsaved.permission_manager.acl.permissions if
@@ -56,9 +56,10 @@
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
private
def valid_future_date?(item, attribute)
+ return true if item.fields[attribute].blank?
raise StandardError, "#{item.model} must use a future date" if item.fields[attribute] < Time.zone.now
end
def save_lease_or_embargo(unsaved)
if unsaved.embargo.present?