CONSUL
Search…
Components
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:
1
require_dependency Rails.root.join("app", "components", "admin", "table_actions_component").to_s
2
3
class Admin::TableActionsComponent
4
# Your custom logic here
5
end
Copied!
If, on the other hand, you also want to customize the view, you need a small modification. Instead of the previous code, use:
1
class Admin::TableActionsComponent < ApplicationComponent; end
2
3
require_dependency Rails.root.join("app", "components", "admin", "table_actions_component").to_s
4
5
class Admin::TableActionsComponent
6
# Your custom logic here
7
end
Copied!
This will make the component use the view in app/components/custom/admin/table_actions_component.html.erb. You can create this file and customize it to your needs.
Last modified 6mo ago
Copy link