Update documentation to load custom code
Just like mentioned in commit 6552e3197d, we need to use `load` instead
of `require_dependency` since we started using zeitwerk.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
For components, customization can be used to change both the logic (included in a `.rb` file) and the view (included in a `.erb` file). If you only want to customize the logic for, let's say, the `Admin::TableActionsComponent`, create a file named `app/components/custom/admin/table_actions_component.rb` with the following content:
|
||||
|
||||
```ruby
|
||||
require_dependency Rails.root.join("app", "components", "admin", "table_actions_component").to_s
|
||||
load Rails.root.join("app", "components", "admin", "table_actions_component.rb")
|
||||
|
||||
class Admin::TableActionsComponent
|
||||
# Your custom logic here
|
||||
@@ -15,7 +15,7 @@ If, on the other hand, you also want to customize the view, you need a small mod
|
||||
```ruby
|
||||
class Admin::TableActionsComponent < ApplicationComponent; end
|
||||
|
||||
require_dependency Rails.root.join("app", "components", "admin", "table_actions_component").to_s
|
||||
load Rails.root.join("app", "components", "admin", "table_actions_component.rb")
|
||||
|
||||
class Admin::TableActionsComponent
|
||||
# Your custom logic here
|
||||
|
||||
@@ -5,7 +5,7 @@ If you need to create new models or customize existent ones, you can do it so at
|
||||
For example for Madrid's City Hall fork its required to check the zip code's format (it always starts with 280 followed by 2 digits). That check is at `app/models/custom/verification/residence.rb`:
|
||||
|
||||
```ruby
|
||||
require_dependency Rails.root.join('app', 'models', 'verification', 'residence').to_s
|
||||
load Rails.root.join("app", "models", "verification", "residence.rb")
|
||||
|
||||
class Verification::Residence
|
||||
|
||||
|
||||
Reference in New Issue
Block a user