Sha256: 23b7fd8211cc7b87d86dfd822d6df37acea9193b4f3751b0bdf316ec8649bb7f

Contents?: true

Size: 547 Bytes

Versions: 12

Compression:

Stored size: 547 Bytes

Contents

# frozen_string_literal: true
# @see https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#custom-strategies
# @example
#   let(:resource) { FactoryBot.valkyrie_create(:hyrax_work) }
class ValkyrieCreateStrategy
  def result(evaluation)
    evaluation.notify(:after_build, evaluation.object)
    evaluation.notify(:before_create, evaluation.object)

    result = persister.save(resource: evaluation.object)

    evaluation.notify(:after_create, result)
    result
  end

  private

  def persister
    Hyrax.persister
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hyrax-3.4.2 lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb
hyrax-4.0.0.beta1 lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb
hyrax-3.4.1 lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb
hyrax-3.4.0 lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb
hyrax-3.3.0 lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb
hyrax-3.2.0 lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb
hyrax-3.1.0 lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb
hyrax-3.0.2 lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb
hyrax-3.0.1 lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb
hyrax-3.0.0 lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb
hyrax-3.0.0.pre.rc4 lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb
hyrax-3.0.0.pre.rc3 lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb