Sha256: 21b5b7ee2248f368bec40236e0a9acf38af35a1d888cc69b333d9d8b7f8c30cd
Contents?: true
Size: 591 Bytes
Versions: 25
Compression:
Stored size: 591 Bytes
Contents
# frozen_string_literal: true module Decidim module Admin class CreateImport < Rectify::Command def initialize(form) @form = form end def call return broadcast(:invalid) if form.invalid? imported_data = form.importer.prepare transaction do form.importer.import! return broadcast(:ok, imported_data) rescue StandardError raise ActiveRecord::Rollback end # Something went wrong with import/finish broadcast(:invalid) end attr_reader :form end end end
Version data entries
25 entries across 25 versions & 1 rubygems