diff --git a/app/seeders/root_seeder.rb b/app/seeders/root_seeder.rb index 2c29a9c666..2bc663098e 100644 --- a/app/seeders/root_seeder.rb +++ b/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