Skip to content

feat: Add Rails 8 compatibility#4

Open
matt423 wants to merge 1 commit intomasterfrom
rails-8-support
Open

feat: Add Rails 8 compatibility#4
matt423 wants to merge 1 commit intomasterfrom
rails-8-support

Conversation

@matt423
Copy link

@matt423 matt423 commented Oct 14, 2025

Changes

  • Allow use of Rails 8 and it's dependencies with this gem.
  • Fix deprecation's and other compatibility issues

Note: We have a green CI on the website using this branch

Rails 8 Compatibility Test Results

Success: Net +4 Test Improvements

Branch Tests Passing Issues
main (baseline) 33 22 11
rails-8-support 35 26 9
Change +2 +4 -2

Fixed by Upgrade

  • 2x Generator Tests: Migration template Rails 8 compatibility
  • 2x Model Tests: ActiveRecord default value handling improvements

Pre-existing Issues (unchanged from main)

  • 🟡 9x Integration Test Issues: Capybara UI setup problems (not functional failures)

Copilot Summary

This pull request updates the codebase for compatibility with Rails 8 and modern Ruby versions, refactors authentication flows, improves internationalization usage, and cleans up legacy code and tests. The changes focus on upgrading dependencies, ensuring migration and generator compatibility, updating authentication methods, and improving error handling and translation usage.

Rails 8 and Ruby 3+ compatibility:

  • Updated gem dependencies in Gemfile and devise_google_authenticator.gemspec for Rails 8 and Ruby 3+, including newer versions of activerecord, sqlite3, and test gems. Also set minimum Ruby version to 3.0.0 and updated runtime dependencies for Rails 8 support. [1] [2] [3]
  • Updated migration templates and migration usage to use ActiveRecord::Migration.current_version and Rails 8 migration context, ensuring compatibility with the latest Rails migration system. [1] [2] [3] [4] [5]

Authentication and controller improvements:

  • Replaced legacy sign_in with bypass_sign_in in authentication flows for better Devise compatibility and security. [1] [2]
  • Improved error message rendering in forms by replacing devise_error_messages! with a partial for shared error messages.

Internationalization and translation updates:

  • Refactored all translation lookups to use dot notation (e.g., I18n.t('devise.registration.title')) instead of scope: option, for consistency and modern Rails conventions. [1] [2] [3]
  • Ensured locale files are loaded in the Rails engine during initialization for proper I18n support.

Code quality and test improvements:

  • Added restoration of default configuration values in test teardown to prevent test pollution, and removed unnecessary stubbing from tests. [1] [2] [3]
  • Updated code to use modern Ruby and Rails conventions (e.g., File.exist?, head :ok, improved resource path name logic, added attr_accessor for gauth_token). [1] [2] [3] F42b04b0L1, [4]

- Update Rails dependency to support Rails 8.x in gemspec
- Replace deprecated sign_in method with bypass_sign_in
- Update I18n translation syntax for Rails 8 compatibility
- Fix File.exists? deprecation in generators
- Use dynamic migration versions for future compatibility
- Preserve original migration structure (up/down methods)
- Update Ruby requirement to >= 3.0.0
@matt423 matt423 self-assigned this Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant