Skip to content

Fixed undefined error when running rails g impressionist(undefined method `timestamped_migrations')#312

Open
ihatov08 wants to merge 1 commit intocharlotte-ruby:masterfrom
ihatov08:fix_rails_g_impressionist
Open

Fixed undefined error when running rails g impressionist(undefined method `timestamped_migrations')#312
ihatov08 wants to merge 1 commit intocharlotte-ruby:masterfrom
ihatov08:fix_rails_g_impressionist

Conversation

@ihatov08
Copy link

The following error occurred when running rails g impressionist, so I fixed it.

/usr/local/bundle/gems/activerecord-7.1.3.2/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `timestamped_migrations' for ActiveRecord::Base:Class (NoMethodError)

ActiveRecord.timestamped_migrations is now used when the major version of rails is 7 or higher.

@stadniklksndr
Copy link

Hey @johnmcaliley @sferik @coryschires @acnalesso @jgrau @lusinh @invalidusrname, could you please take a look at this?

@bjornlinder
Copy link

👍 here, good fix for rails 7.

@stadniklksndr
Copy link

Instead of manually defining self.next_migration_number we can simply include the built-in Rails module include ::ActiveRecord::Generators::Migration

example - https://github.com/stadniklksndr/impressionist/blob/master/lib/generators/active_record/impressionist_generator.rb

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.

3 participants