Modernize for Rails 7/8: dependency-free JS, form_with support, pluggable data source - #69
Merged
Conversation
…able data source Drops the jQuery/Chosen requirement in favor of a dependency-free JS core with a bundled Stimulus controller (importmap-rails, Sprockets, and npm builds), adds native form_with/form_for helpers so simple_form is no longer required, and introduces a pluggable data source with priority/only/except country filtering, flags, dial codes, and I18n localization. HTTP caching is added to the JSON lookup endpoints, and a new install generator sets up the initializer. Requires Rails >= 7.0 and Ruby >= 3.1 going forward (3.x remains for older Rails). The legacy jQuery/Chosen JS keeps working, deprecated. Adds a runnable Rails 7/8 demo app under spec/dummy (Propshaft + importmap + Stimulus) that doubles as the integration test target, and expands CI to a Rails 7.0/7.1/7.2/8.0 matrix alongside the Ruby matrix. See CHANGELOG.md and docs/migration-v4.md for details.
The CI matrix runs the dummy app across Ruby 3.1-3.4; pinning it to the one version it happened to be generated under is misleading.
arvindvyas
force-pushed
the
modernization-v4
branch
from
July 3, 2026 19:17
85b9c55 to
6158879
Compare
Flagged by CodeQL: it was missing protect_from_forgery, which rails new includes by default. The lookup controller's own skip_forgery_protection for its read-only GET endpoints is unaffected.
db/schema.rb and the migration were checked in with ActiveRecord::Schema[8.1]/Migration[8.1], generated on my local Rails 8.1. That version doesn't exist on Rails 7.0/7.1/7.2/8.0, so a fresh `db:test:load_schema` (as CI does) raised "Unknown migration version 8.1" and every request spec failed with "Could not find table 'businesses'". It passed in my local testing across those gemfiles only because the local test.sqlite3 already had the table from an earlier run and never needed to reload schema.rb. Pinned both to 7.0, the floor of the supported range, and verified against a freshly deleted test.sqlite3 across the default Gemfile and all 4 pinned Rails versions.
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
form_with/form_forsupport (f.country_select,f.state_select,f.city_select) so simple_form is no longer required; existing simple_form usage is unchanged.CountryStateSelect::DataSources::Base),priority_countries/only/exceptfiltering, flag emoji + dial code labels, and I18n-localized country names.Cache-Control/ETag) to the/find_states//find_citiesJSON endpoints, and a documented pattern for mounting them at a custom path.rails g country_state_select:install).spec/dummy(Propshaft + importmap + Stimulus) that doubles as the integration test target, plus request/unit specs for all of the above.engine3.rb/railtie.rbcode paths); the 3.x gem remains available for older Rails.See
CHANGELOG.mdanddocs/migration-v4.mdfor the full list and upgrade notes.Test plan
bundle exec rspec— 58 examples, 0 failures (default Gemfile, latest Rails)gemfiles/rails_7.0.gemfile,rails_7.1.gemfile,rails_7.2.gemfile,rails_8.0.gemfilespec/dummy) in a real browser: country → state → city cascade over AJAX, aria-live announcements, and an edit-page load correctly pre-populates the saved state/city with zero extra AJAX callsbundle exec bundler-audit check --update— no vulnerabilities