Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rails g dev_toolbar:install #8

Open
raghubetina opened this issue Jun 11, 2024 · 0 comments
Open

rails g dev_toolbar:install #8

raghubetina opened this issue Jun 11, 2024 · 0 comments

Comments

@raghubetina
Copy link

It would be cool to add a generator that puts config/initializers/dev_toolbar.rb into place.

Even cooler would be if it checked for the presence of a few gems and, if detected, prepopulated the config; e.g. if rails_db gem is present, then add a link to /rails/db.

bpurinton added a commit that referenced this issue Oct 21, 2024
I noticed that for our Rails projects which all have this line in the `bin/setup` script:

```
bundle exec rake db:create RAILS_ENV=test
```

setup fails with this error when the `config/initializers/dev_toolbar.rb` is not wrapped in a development environment check:

```
== Creating test database ==
rake aborted!
NameError: uninitialized constant DevToolbar (NameError)

DevToolbar.configure do |config|
^^^^^^^^^^
```

That surprised me given that the `call` method in the gem currently has a check for `Rails.env.development?`

---

Perhaps there is a better solution than just updating the README to point out this requirement, however, on #8, there is already planned work to create a generator for the initializer. During that work, we can investigate this more deeply, but for now, since we need this working for class, I think we just need this instruction in the README and to have all the initializers use this slight hack.

Since all initializers will be uniform across our Rails projects and managed with the [project-syncing tool](https://github.com/firstdraft/project-syncing), it will be easy to fix this later on across the projects that are using the `dev_toolbar` gem.
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

No branches or pull requests

1 participant