Upgrade to Rails 8.0 and Ruby 3.4.5 #4
Draft
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.
Overview
This PR upgrades the entire MapWarper codebase from Rails 4.2 (Ruby 2.4) to Rails 8.0 (Ruby 3.4.5), a major upgrade spanning 8 Rails versions that modernizes the application with improved performance, security, and developer experience.
Motivation
The application was running on Rails 4.2, which reached end-of-life years ago and poses security risks. This upgrade brings the codebase to the latest stable Rails version, ensuring:
Major Changes
Ruby & Rails
.ruby-versionto specify Ruby 3.4.5Core Dependencies
pg0.21 → 1.5.xactiverecord-postgis-adapter3.0 → 11.0acts-as-taggable-on3.5.0 → 12.0 (Rails 8 compatible)devise4.7+ → 4.9+ (with Hotwire/Turbo support)audited-activerecord→audited(modern version)Gem Replacements
factory_girl_rails→factory_bot_rails(industry standard naming)paperclip→kt-paperclip(Rails 7+ compatible fork, migration to ActiveStorage planned)mimemagic→marcel(Rails built-in MIME detection)Removed Dependencies
simple_token_authentication- Incompatible with Rails 8; API token auth should migrate to Devise tokensrails-api- Functionality merged into Rails coreredis-rails- Replaced with nativeredis_cache_storeactionpack-action_caching- Deprecated; use HTTP caching insteadspring- Deprecated in Rails 8coffee-rails,uglifier- Replaced by modern JavaScript pipelineModern Asset Pipeline
Added Hotwire and modern JavaScript tooling:
propshaft- Modern asset pipeline replacement for Sprocketsimportmap-rails- JavaScript with ES modulesstimulus-rails- Hotwire Stimulus frameworkturbo-rails- Hotwire Turbo for fast page updatesConfiguration Updates
Core Files
config/application.rbwithconfig.load_defaults 8.0andconfig.autoload_libconfig/boot.rb,config.ru, andRakefileto userequire_relativeand__dir__bin/railsandbin/rake, removed deprecatedbin/springEnvironment Files
:redis_storeto:redis_cache_storewith proper hash configurationconfig.serve_static_filestoconfig.public_file_server.enabledconfig.assets.raise_runtime_errorsandconfig.active_record.raise_in_transactional_callbacksInitializers
application_config.rbto addaliases: truefor Psych 4+ compatibilityRack::Corsreference from string to constant incors.rb_rails4_mapwarper_sessionto_rails8_mapwarper_sessionapp/assets/config/manifest.jsfor Sprockets compatibilitysimple_token_authentication.rb(moved to.bak)Code Changes
Models
acts_as_token_authenticatablewith TODO for Devise token migrationTests
test/test_helper.rband all factory files to useFactoryBotinstead ofFactoryGirlrequire_relativeVerification
✅ Bundle install successful - All 167 gems installed without conflicts
✅ Rails console loads - Verified Rails 8.0.3 running successfully
✅ Rake tasks available - Database tasks, asset tasks all present
✅ All initializers load - No errors during application boot
Documentation
Added comprehensive
RAILS8_UPGRADE.mddocumenting:Next Steps
Before Deployment:
simple_token_authenticationbundle exec rake db:migratein all environmentskt-paperclipto ActiveStorage (Rails native)Deployment Notes:
Gemfile.lockand rebuild native extensionsbundle exec rake assets:precompileBenefits
This upgrade provides:
This is a foundational upgrade that positions MapWarper for continued development and enhancement with modern Rails features and best practices.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.