Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `timestamped_migrations' for ActiveRecord::Base:Class (NoMethodError) #115

Closed
davidalejandroaguilar opened this issue Nov 18, 2023 · 1 comment

Comments

@davidalejandroaguilar
Copy link

davidalejandroaguilar commented Nov 18, 2023

Seems like it's not working for Rails 7.1.1

rails g rails_settings:migration
/Users/david/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/activerecord-7.1.1/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `timestamped_migrations' for ActiveRecord::Base:Class (NoMethodError)

The problem is in the generator, so I just made my own migration:

rails g migration add_rails_settings

And copy and pasted the migration from the generator template:

class AddRailsSettings < ActiveRecord::Migration[7.1]
  def self.up
    create_table :settings do |t|
      t.string :var, null: false
      t.text :value
      t.references :target, null: false, polymorphic: true
      t.timestamps null: true
    end
    add_index :settings, %i[target_type target_id var], unique: true
  end

  def self.down
    drop_table :settings
  end
end
@ledermann
Copy link
Owner

@davidalejandroaguilar Thanks for your report!

This is already fixed in #114, I just released v2.6.1 to make it available.

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

No branches or pull requests

2 participants