简体   繁体   中英

Rails unable to generate model

I am trying to learn rails by following the tutorial here . However when I got to the section on creating the model and ran this command:

bin/rails generate model Article title:string text:text

I got this error:

/usr/lib/ruby/vendor_ruby/spring/application.rb:152:in `serve': undefined method `cleanup!' for ActionDispatch::Reloader:Class (NoMethodError)
from /usr/lib/ruby/vendor_ruby/spring/application.rb:131:in `block in run'
from /usr/lib/ruby/vendor_ruby/spring/application.rb:125:in `loop'
from /usr/lib/ruby/vendor_ruby/spring/application.rb:125:in `run'
from /usr/lib/ruby/vendor_ruby/spring/application/boot.rb:18:in `<top (required)>'
from /usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'

This is my second go through so I know I have followed all the steps. Any idea where I might look for the solution or know what the solution is? This really has me stuck.

Versions:

  • Ubuntu 16.04
  • ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
  • gem 2.6.12
  • rails 5.1.0

基于此问题 ,您可以运行spring stop并尝试再次运行命令吗?

Restarting worked for me too, but I needed to do it every-time. Instead, I upgraded to to the latest version of spring (2.0.2) in my gemfile. This fixed it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM