Rails上未定义的方法“ load_defaults”会生成迁移并在Rails控制台中

时间:2018-10-05 14:49:36

标签: ruby-on-rails rails-generators

运行时出现此错误:rails generate migration AddRoleToBuyer role:integer

错误:

/usr/lib/ruby/vendor_ruby/rails/railtie/configuration.rb:95:in `method_missing': undefined method `load_defaults' for #<Rails::Application::Configuration:0x000055e8c09a10d8> (NoMethodError)
    from /home/murilo/projects/api-service/config/application.rb:24:in `<class:Application>'
    from /home/murilo/projects/api-service/config/application.rb:22:in `<module:ApiService>'
    from /home/murilo/projects/api-service/config/application.rb:21:in `<top (required)>'
    from /home/murilo/projects/api-service/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `require'
    from /home/murilo/projects/api-service/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `preload'
    from /home/murilo/projects/api-service/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
    from /home/murilo/projects/api-service/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
    from /home/murilo/projects/api-service/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
    from /home/murilo/projects/api-service/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
    from /home/murilo/projects/api-service/vendor/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
    from -e:1:in `<main>'

应用程序和rspec测试正在正常运行,但是迁移无法正常工作。

编辑:当我也运行rails console时也会发生这种情况。

0 个答案:

没有答案