Class: Hyrax::Transactions::Steps::SetDefaultAdminSet

Inherits:
Object
  • Object
show all
Includes:
Dry::Transaction::Operation
Defined in:
lib/hyrax/transactions/steps/set_default_admin_set.rb

Overview

A `dry-transaction` step that sets the `AdminSet` for an input work to the default admin set, if none is already set. Creates the default admin set if it doesn't already exist.

Since:

  • 2.4.0

Instance Method Summary collapse

Instance Method Details

#call(work) ⇒ Dry::Monads::Result

Parameters:

Returns:

  • (Dry::Monads::Result)

Since:

  • 2.4.0


16
17
18
19
20
21
# File 'lib/hyrax/transactions/steps/set_default_admin_set.rb', line 16

def call(work)
  work.admin_set ||=
    AdminSet.find(AdminSet.find_or_create_default_admin_set_id)

  Success(work)
end