README.md in dry-system-rails-0.2.0 vs README.md in dry-system-rails-0.3.0
- old
+ new
@@ -22,11 +22,11 @@
gem 'dry-system-rails'
```
## Usage
-To configure auto-registration create `config/initializer/system.rb` with the following content:
+To configure auto-registration create `config/initializers/system.rb` with the following content:
``` ruby
Dry::System::Rails.container do
# you can set it to whatever you want and add as many dirs you want
config.auto_register << 'lib'
@@ -63,11 +63,12 @@
The Rails API is designed around the usage of class methods. If you choose to write domain logic in objects you will likely encounter a situation where your code will have to use one of the framework components. That is where manual registration using [bootable dependency](https://dry-rb.org/gems/dry-system/booting) will come in handy.
E.g. You have an object `CreateWidget` that needs to process widgets asynchronously with an `Widgets:NotificationJob` but you want to leverage dependency injection to decouple the components:
```ruby
-# config/initializer/system.rb
-Dry::System::Rails.configure do |config|
+# config/initializers/system.rb
+Dry::System::Rails.container do
+ # changes `self` to the container
config.auto_register << 'lib'
end
# app/jobs/widgets/notification_job.rb
class Widgets::NotificationJob < ApplicationJob