Skip to content

Commit

Permalink
save the embargo and lease before setting it, so we have access to th…
Browse files Browse the repository at this point in the history
…e id
  • Loading branch information
alishaevn committed Jul 12, 2023
1 parent 30e7794 commit efffe9b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/hyrax/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def visibility
def embargo=(value)
raise TypeError "can't convert #{value.class} into Hyrax::Embargo" unless value.is_a? Hyrax::Embargo

@embargo = value
@embargo = Hyrax.persister.save(resource: value)
self.embargo_id = @embargo.id
end

Expand All @@ -117,7 +117,7 @@ def embargo
def lease=(value)
raise TypeError "can't convert #{value.class} into Hyrax::Lease" unless value.is_a? Hyrax::Lease

@lease = value
@lease = Hyrax.persister.save(resource: value)
self.lease_id = @lease.id
end

Expand Down

0 comments on commit efffe9b

Please sign in to comment.