Fix: make Railtie compatible with Rails 8 by removing sqlite3_production_warning #139
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.
Summary
This PR fixes a compatibility issue with Rails 8.
In Rails 8, the
sqlite3_production_warning
configuration key and its writer method (ActiveRecord::Base.sqlite3_production_warning=
) were removed.The current litestack Railtie still sets this flag unconditionally, which causes Rails 8 applications to fail at boot with:
Changes
lib/litestack/railtie.rb
initializer:sqlite3_production_warning = false
).config.active_record
so ActiveRecord does not attempt to apply it.Why
The entire purpose of litestack is to make SQLite production-ready. Disabling the Rails “don’t use SQLite in production” warning is still important for Rails 6/7.
However, since Rails 8 removed this config entirely, litestack should not attempt to set it anymore.
Impact
Example
Before this change, Rails 8 apps using litestack crashed during boot.
After applying this change, the same apps boot cleanly:
One more note:
In my app, I had added some debugging in my
config/application.rb
thusly:With this PR,
sqlite3_production_warning
was not included in the keys in my Rails 8 app.