Class: Iron::Seed
- Inherits:
-
Object
- Object
- Iron::Seed
- Defined in:
- app/models/iron/seed.rb
Constant Summary collapse
- DEFAULT_PATH =
"db/seeds/iron.zip"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.dump(path = nil) ⇒ Object
5 |
# File 'app/models/iron/seed.rb', line 5 def self.dump(path = nil) = new(path).dump |
.load(path = nil) ⇒ Object
6 |
# File 'app/models/iron/seed.rb', line 6 def self.load(path = nil) = new(path).load |
Instance Method Details
#dump ⇒ Object
8 9 10 11 |
# File 'app/models/iron/seed.rb', line 8 def dump FileUtils.mkdir_p(path.dirname) Exporter.new(path).export end |
#load ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/models/iron/seed.rb', line 13 def load return unless path.exist? return if already_seeded? Schema.suppress_auto_dump do user, account = bootstrap Current.set(user: user, account: account) do Importer.new(path).import end end end |