File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -478,6 +478,22 @@ You can even execute ruby code written in a file with runner.
478
478
$ bin/rails runner lib/code_to_be_run.rb
479
479
` ` `
480
480
481
+ By default, ` rails runner` scripts are automatically wrapped with the Rails Executor, which helps report uncaught exceptions for tasks like cron jobs.
482
+
483
+ Therefore, executing ` rails runner lib/long_running_scripts.rb` is functionally equivalent to the following:
484
+
485
+ ` ` ` ruby
486
+ Rails.application.executor.wrap do
487
+ # executes code inside lib/long_running_scripts.rb
488
+ end
489
+ ` ` `
490
+
491
+ You can opt out of this behaviour by using the ` --skip-executor` option.
492
+
493
+ ` ` ` bash
494
+ $ bin/rails runner --skip-executor lib/long_running_script.rb
495
+ ` ` `
496
+
481
497
# ## `bin/rails destroy`
482
498
483
499
Think of ` destroy` as the opposite of ` generate` . It' ll figure out what generate did, and undo it.
You can’t perform that action at this time.
0 commit comments