Sorcery/sorcery

Rails 7.1 support

simchikoops opened this issue · 1 comments

Configuration

  • Sorcery Version: 2.0.9
  • Ruby Version: 3.2.2
  • Framework: Rails
  • Platform: Mac

Expected Behavior

Generator

Generator should run successfully.

Actual Behavior

/Users/koops/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.0.rc1/lib/active_record/dynamic_matchers.rb:22:in method_missing': undefined method timestamped_migrations' for ActiveRecord::Base:Class (NoMethodError) from /Users/koops/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sorcery-0.16.5/lib/generators/sorcery/install_generator.rb:78:in next_migration_number'
from /Users/koops/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.0.rc1/lib/rails/generators/migration.rb:43:in set_migration_assigns!' from /Users/koops/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.0.rc1/lib/rails/generators/migration.rb:59:in migration_template'
from /Users/koops/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sorcery-0.16.5/lib/generators/sorcery/install_generator.rb:65:in copy_migration_files'

Steps to Reproduce

  1. Run rails generate sorcery:install
whyczz commented

I got the same issue:

➜ rails g sorcery:install
      create  config/initializers/sorcery.rb
    generate  model User --skip-migration
       rails  generate model User --skip-migration 
      invoke  active_record
      create    app/models/user.rb
      invoke    test_unit
      create      test/models/user_test.rb
      create      test/fixtures/users.yml
      insert  app/models/user.rb
File unchanged! Either the supplied flag value not found or the content has already been inserted!  app/models/user.rb
/Users/a/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-7.1.0/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `timestamped_migrations' for ActiveRecord::Base:Class (NoMethodError)
	from /Users/a/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sorcery-0.16.5/lib/generators/sorcery/install_generator.rb:78:in `next_migration_number'
	from /Users/a/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/generators/migration.rb:43:in `set_migration_assigns!'
	from /Users/a/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.1.0/lib/rails/generators/migration.rb:59:in `migration_template'
	from /Users/a/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sorcery-0.16.5/lib/generators/sorcery/install_generator.rb:65:in `copy_migration_files'

It seems that 'timestamped_migrations' is deprecated/removed as of rails 5.
That happens in the install generator.

Guess

Closest thing I can find is a configuration value of the same name,
So a change to that should be the fix?