Instructions to wrap initializer in development check #12
+10
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that for our Rails projects which all have this line in the
bin/setup
script:setup fails with this error when the
config/initializers/dev_toolbar.rb
is not wrapped in a development environment check:That surprised me given this code in the gem:
dev_toolbar/lib/dev_toolbar/middleware.rb
Line 10 in 4acbc33
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 ASAP 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, it will be easy to fix this later on across the projects that are using the
dev_toolbar
gem.Important
Wraps
DevToolbar.configure
in a development check to prevent test database creation errors, updatingREADME.md
accordingly.DevToolbar.configure
inconfig/initializers/dev_toolbar.rb
withif Rails.env.development?
to prevent errors during test database creation.README.md
to include the development environment check in the configuration example.This description was created by
for f47a9f2. It will automatically update as commits are pushed.