Class: Spree::SampleData::LoadJob

Inherits:
BaseJob
  • Object
show all
Defined in:
app/jobs/spree/sample_data/load_job.rb

Overview

Loads the demo catalog, customers and orders in the background. Enqueued by first-run setup when the merchant ticks "load sample data": the loader needs an admin to own its imports and downloads product images, so it can neither run before setup nor inside the setup request.

Constant Summary

Constants inherited from BaseJob

BaseJob::TRANSIENT_ERRORS

Instance Method Summary collapse

Instance Method Details

#perform(store_id = nil) ⇒ Object

Parameters:

  • store_id (String, Integer, nil) (defaults to: nil) —

    the store to load into; the default store when omitted



10
11
12
13
14
15
# File 'app/jobs/spree/sample_data/load_job.rb', line 10

def perform(store_id = nil)
  return Spree::SampleData::Loader.call if store_id.nil?

  store = Spree::Store.find_by(id: store_id)
  Spree::SampleData::Loader.call(store: store) if store
end