create.rb 555 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Common::Model::Create < Sequencer::Unit::Base
  3. include ::Sequencer::Unit::Import::Common::Model::Mixin::HandleFailure
  4. prepend ::Sequencer::Unit::Import::Common::Model::Mixin::Skip::Action
  5. skip_any_action
  6. uses :mapped, :model_class
  7. provides :instance, :action
  8. def process
  9. instance = model_class.new(mapped)
  10. state.provide(:instance, instance)
  11. state.provide(:action, :created)
  12. rescue => e
  13. handle_failure(e)
  14. end
  15. end