almost 2 years ago

报错信息:
liu@liudeMacBook-Pro ⮀ ~/railsbridge/suggestotron ⮀ ⭠ master± ⮀ rails c
Running via Spring preloader in process 8483
Loading development environment (Rails 5.0.0.1)
2.3.1 :001 > Topic.count
NameError: undefined local variable or method Topic' for main:Object
from (irb):1
from /Users/liu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in
start'
from /Users/liu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
...
1588 /Users/liu/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/table_metadata.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

异常退出了。

解决方法:
exit退出rails c后
输入命令spring stop
重新运行rails c
重新输入Topic.count
可以了。

← 3-1 解决每一次 rails new 都会卡住的问题 gem源配置的问题 →
 
comments powered by Disqus