Skip to content

Mount the debugbar engine automatically#51

Merged
julienbourdeau merged 1 commit intomasterfrom
feat/load-routes-automatically
Jan 8, 2025
Merged

Mount the debugbar engine automatically#51
julienbourdeau merged 1 commit intomasterfrom
feat/load-routes-automatically

Conversation

@julienbourdeau
Copy link
Owner

@julienbourdeau julienbourdeau commented Jan 8, 2025

It also shows warning logs to help you upgrade your codebase. The following block should be removed from your config/routes.rb

- if defined? Debugbar
-   mount Debugbar::Engine => Debugbar.config.prefix
- end

I dunno why this wasn't done originally 🤷‍♂️

It also shows warning logs to help you upgrade your codebase. The following block should be removed from your `config/routes.rb`

```
if defined? Debugbar
  mount Debugbar::Engine => Debugbar.config.prefix
end
```
@julienbourdeau julienbourdeau force-pushed the feat/load-routes-automatically branch from 2d8fb02 to 4148239 Compare January 8, 2025 20:27
initializer "debugbar.append_routes" do |app|
# Before 0.5.0, I asked people to mount the engine manually
# This will probably throw an error at some point to be ultimately removed
app.routes.append do
Copy link
Owner Author

@julienbourdeau julienbourdeau Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice that we append to be able to check of the route was already defined (by the main app routes.rb file).
You'd get an error if you try to mount the same engine twice.

@julienbourdeau julienbourdeau merged commit 10ec32a into master Jan 8, 2025
@julienbourdeau julienbourdeau deleted the feat/load-routes-automatically branch January 8, 2025 20:29
julienbourdeau added a commit to julienbourdeau/debugbar.dev that referenced this pull request Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant