Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zeitwerk note to README #342

Merged
merged 1 commit into from
Feb 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,24 @@ directory of a Rails app, or pass the path to a Rails app in with the
the `app/consumers/` directory, to allow them to be auto-loaded when Rails
boots.

If you're using the new Zeitwerk autoloader (enabled by default in Rails 6)
and the consumers are not loaded in development environment you will need to
trigger the autoloading in an initializer with

```ruby
::Zeitwerk::Loader.eager_load_all
```

or with something more specific like

```ruby
autoloader = Rails.autoloaders.main

Dir.glob(File.join("**", "*_consumer.rb")).each do |consumer|
autoloader.preload(consumer)
end
```

To require files that define consumers manually, simply pass each file as an
option to `--require`. Hutch will automatically detect whether you've provided
a Rails app or a standard file, and take the appropriate behaviour:
Expand Down