Getting Started
Installation
Setup the Debugbar dev tools in your project
Require the gem
The debugbar is installed like any other gem. Add it to your Gemfile, then run bundle install
to install it.
As of today, you should only run the debugbar in development.
1group :development do2 gem 'debugbar'3end
Render the debugbar
With the ERB helper
In your layout, make sure the debugbar is rendered via the view helper.
1<!DOCTYPE html> 2<html> 3 <head> 4 ... 5 <%= debugbar_head if defined? Debugbar %> 6 </head> 7 8 <body> 9 ...10 <%= debugbar_body if defined? Debugbar %> 11 </body>12</html>
Without the ERB helper
If your application doesn't use the erb
view helper, you can render the debugbar manually.
This can be useful if your frontend is an SPA and the shell isn't rendered by Rails.
In your index.html
file, make sure the following code is added:
1<!DOCTYPE html> 2<html> 3 <head> 4 ... 5 <script defer src="/_debugbar/assets/script"></script> 6 </head> 7 8 <body> 9 10 <div id="__debugbar" data-turbo-permanent></div> 11 12 <!-- Optional configuration -->13 <script type="text/javascript" data-turbo-permanent>14 window._debugbarConfigOptions = {height: 300}15 </script>16 </body>17</html>
Note that if you changed the route prefix in your configuration, you'll need to update the url in the script tag.
Puma configuration
It's recommended to run Puma in single mode! Rails use single mode by default in dev but if you
modified it, set WEB_CONCURRENCY
env var to 0. Puma cluster mode requires extra configuration.
Troubleshooting
If you run into any error, please open a GitHub issue with as much information as possible. There is also a dedicated Troubleshooting section.