Skip to content

Commit

Permalink
Merge pull request rails#53284 from kabirpathak/update-rails-runner-d…
Browse files Browse the repository at this point in the history
…ocumentation

[ci skip] Document `--skip-executor` option for Rails Runner
  • Loading branch information
rafaelfranca authored Oct 15, 2024
2 parents 2f6bfb3 + fd47f78 commit 8c7e553
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions guides/source/command_line.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,22 @@ You can even execute ruby code written in a file with runner.
$ bin/rails runner lib/code_to_be_run.rb
```
By default, `rails runner` scripts are automatically wrapped with the Rails Executor, which helps report uncaught exceptions for tasks like cron jobs.
Therefore, executing `rails runner lib/long_running_scripts.rb` is functionally equivalent to the following:
```ruby
Rails.application.executor.wrap do
# executes code inside lib/long_running_scripts.rb
end
```
You can opt out of this behaviour by using the `--skip-executor` option.
```bash
$ bin/rails runner --skip-executor lib/long_running_script.rb
```
### `bin/rails destroy`
Think of `destroy` as the opposite of `generate`. It'll figure out what generate did, and undo it.
Expand Down

0 comments on commit 8c7e553

Please sign in to comment.