Fix: make Railtie compatible with Rails 8 by removing sqlite3_production_warning#139
Open
ajitdsa wants to merge 1 commit into
Open
Fix: make Railtie compatible with Rails 8 by removing sqlite3_production_warning#139ajitdsa wants to merge 1 commit into
ajitdsa wants to merge 1 commit into
Conversation
…ion_warning Rails 8 removed the `sqlite3_production_warning` config and its writer method from ActiveRecord::Base. The litestack Railtie was still setting this flag, which caused boot-time NoMethodError in Rails 8 apps. This patch updates `lib/litestack/railtie.rb` to: - Delete the `:sqlite3_production_warning` key when running on Rails 8+, so ActiveRecord doesn’t try to apply it. - Preserve the old behavior (`sqlite3_production_warning = false`) on Rails 6/7, where the key and writer still exist. This allows litestack to run cleanly on Rails 8 without crashing, while remaining compatible with older Rails versions.
|
I just ran into this and it took me a while, thus I'll add more of the error message here for hopefully better searchability: Also: Can we expect this PR to be merged anytime soon? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_warningconfiguration 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.rbinitializer:sqlite3_production_warning = false).config.active_recordso 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.rbthusly:With this PR,
sqlite3_production_warningwas not included in the keys in my Rails 8 app.