diff options
author | Gannon McGibbon <gannon.mcgibbon@gmail.com> | 2019-01-16 19:02:23 -0500 |
---|---|---|
committer | Gannon McGibbon <gannon.mcgibbon@gmail.com> | 2019-01-17 01:08:15 -0500 |
commit | 66cc0e768fb092dbcd12feb3387c2a22e4cbeb37 (patch) | |
tree | bb5096dacb183103c5b12eec8d94e2ec5f442379 /railties/lib/rails | |
parent | 90536ebfb3f0ca6971bc3ea4e43f20b8e977539b (diff) | |
download | rails-66cc0e768fb092dbcd12feb3387c2a22e4cbeb37.tar.gz rails-66cc0e768fb092dbcd12feb3387c2a22e4cbeb37.tar.bz2 rails-66cc0e768fb092dbcd12feb3387c2a22e4cbeb37.zip |
Seed database with inline ActiveJob job adapter
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/engine.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 6a13a84108..f768c30db0 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -548,7 +548,7 @@ module Rails # Blog::Engine.load_seed def load_seed seed_file = paths["db/seeds.rb"].existent.first - load(seed_file) if seed_file + with_inline_jobs { load(seed_file) } if seed_file end # Add configured load paths to Ruby's load path, and remove duplicate entries. @@ -658,6 +658,18 @@ module Rails end end + def with_inline_jobs + queue_adapter = config.active_job.queue_adapter + ActiveSupport.on_load(:active_job) do + self.queue_adapter = :inline + end + yield + ensure + ActiveSupport.on_load(:active_job) do + self.queue_adapter = queue_adapter + end + end + def has_migrations? paths["db/migrate"].existent.any? end |