Class: Hyrax::Transactions::Steps::SetUserAsCreator
- Inherits:
-
Object
- Object
- Hyrax::Transactions::Steps::SetUserAsCreator
- Defined in:
- lib/hyrax/transactions/steps/set_user_as_creator.rb
Overview
Add a given ‘::User` as the `#creator` via a ChangeSet.
If no user is given, simply passes as a ‘Success`.
Defined Under Namespace
Classes: NullUser
Instance Method Summary collapse
Instance Method Details
#call(change_set, user: NullUser.new) ⇒ Dry::Monads::Result
21 22 23 24 25 26 27 |
# File 'lib/hyrax/transactions/steps/set_user_as_creator.rb', line 21 def call(change_set, user: NullUser.new) change_set.creator = [user.user_key] if user.user_key Success(change_set) rescue NoMethodError => err Failure.new([err., change_set], err.backtrace.first) end |