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

ActiveRecord::Migrator.migrations raises NoMethodError #72

Merged
merged 1 commit into from Aug 8, 2018

Conversation

ebihara99999
Copy link
Contributor

Thank you for this great product.

Environment

  • Ruby: 2.5.0
  • Rails: 5.2.0

About the error

I met the error shown below when run rails db:migrate

NoMethodError: undefined method `migrations' for ActiveRecord::Migrator:Class
/app/myapp/vendor/bundle/ruby/2.5.0/gems/hairtrigger-0.2.20/lib/hair_trigger.rb:45:in `migrator'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/hairtrigger-0.2.20/lib/hair_trigger.rb:65:in `current_migrations'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/hairtrigger-0.2.20/lib/hair_trigger/schema_dumper.rb:23:in `triggers'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/hairtrigger-0.2.20/lib/hair_trigger/schema_dumper.rb:7:in `trailer'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/schema_dumper.rb:39:in `dump'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/schema_dumper.rb:22:in `dump'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/railties/databases.rake:251:in `block (4 levels) in <top (required)>'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/railties/databases.rake:250:in `open'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/railties/databases.rake:250:in `block (3 levels) in <top (required)>'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/railties/databases.rake:68:in `block (2 levels) in <top (required)>'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.0/lib/active_record/railties/databases.rake:61:in `block (2 levels) in <top (required)>'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/command.rb:48:in `invoke'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands.rb:18:in `<top (required)>'
/app/myapp/bin/rails:9:in `require'
/app/myapp/bin/rails:9:in `<top (required)>'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/app/myapp/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/app/myapp/bin/spring:13:in `require'
/app/myapp/bin/spring:13:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:schema:dump
(See full trace by running task with --trace)

Cause

This seems to result from this commit

#migrations moves from class methods to instance methods

Difference is:

Thanks for reading.

Note

With travisCI, my forked project's tests failed but I don't know how to fix them. It would be
because of configuration; I would appreciate it if you could suggest how to fix when they also fail here.

@ebihara99999
Copy link
Contributor Author

@jenseng

With travisCI, my forked project's tests failed but I don't know how to fix them. It would be
because of configuration; I would appreciate it if you could suggest how to fix when they also fail here.

The result is same...Would you suggest something about the errors?

@jenseng
Copy link
Owner

jenseng commented May 4, 2018

@ebihara99999 thanks for the pull request, the code looks good 👍

I just triggered a travis build from master and it has the same failures, so it's not a problem with your commit ... something must have changed with a dependency

I'll see about fixing master, then hopefully you can just rebase and the tests will pass 🤞

@ebihara99999
Copy link
Contributor Author

@jenseng
Thanks! I'm relieved it's not because of my commit:relaxed: Would you tell me when you finish that?

@barthez
Copy link
Contributor

barthez commented Jul 27, 2018

@jenseng I've fixed the Travis issue in #74

cc @ebihara99999 @dorian

@ebihara99999
Copy link
Contributor Author

@barthez Thanks a lot!

@liaden
Copy link

liaden commented Jul 29, 2018

I also ran into this so I merged both branches into master on my fork so that I could bundle install. The error then went away for me.

@ebihara99999
Copy link
Contributor Author

@jenseng
I will merge master and rerun CI if #74 is merged into master. Could you review it?

@DNNX
Copy link

DNNX commented Aug 6, 2018

@jenseng any updates here?

@DNNX DNNX mentioned this pull request Aug 6, 2018
@jenseng jenseng merged commit 73ba6e5 into jenseng:master Aug 8, 2018
@jenseng
Copy link
Owner

jenseng commented Aug 8, 2018

v0.2.21 has been released with these fixes, thanks for the PRs!

@ebihara99999
Copy link
Contributor Author

Thanks!

@ebihara99999 ebihara99999 deleted the fix-migrations-error branch August 10, 2018 02:11
michalc added a commit to uktrade/export-opportunities that referenced this pull request Aug 10, 2018
Without this, then running migrations would get...

  NoMethodError: undefined method `migrations' for ActiveRecord::Migrator:Class

This is documented at jenseng/hair_trigger#72
agiamas pushed a commit to uktrade/export-opportunities that referenced this pull request Aug 10, 2018
* (build) Run tests in same version of Ruby as in Gemfile

* (docs) The elastic.co images no longer works

It throws the error

    docker: Error response from daemon: pull access denied for
    docker.elastic.co/elasticsearch, repository does not exist or may require
    'docker login'.

* (fix) Bump hairtrigger to avoid migrations error

Without this, then running migrations would get...

  NoMethodError: undefined method `migrations' for ActiveRecord::Migrator:Class

This is documented at jenseng/hair_trigger#72

* (fix) Avoid Faker error

Without this, then the error

   NameError: uninitialized constant Faker

would occur

* (fix) Rails 5.2 renamed a method

https://guides.rubyonrails.org/5_2_release_notes.html#active-support-notable-changes

(search for secure_compare, which shows its safe for variable length strings)
Repository owner deleted a comment Jul 16, 2019
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.

None yet

5 participants