parameterize seeding of development data

pull/7800/head
Markus Kahl 5 years ago
parent 49174d3f01
commit 46938a7b90
  1. 10
      app/seeders/root_seeder.rb

@ -35,11 +35,13 @@
class RootSeeder < Seeder
include Redmine::I18n
def initialize
def initialize(seed_development_data: Rails.env.development?)
require 'basic_data_seeder'
require 'demo_data_seeder'
require 'development_data_seeder'
@seed_development_data = seed_development_data
rails_engines.each { |engine| load_engine_seeders! engine }
end
@ -62,7 +64,7 @@ class RootSeeder < Seeder
puts '*** Seeding demo data'
DemoDataSeeder.new.seed!
if Rails.env.development?
if seed_development_data?
seed_development_data
end
@ -73,6 +75,10 @@ class RootSeeder < Seeder
end
end
def seed_development_data?
@seed_development_data
end
def rails_engines
::Rails::Engine.subclasses.map(&:instance)
end

Loading…
Cancel
Save