我一直在使用Rails控制台进行测试和学习,遇到错误时,无法使用“Control + C”命令退出。还有其他命令要退出吗?
这是我尝试执行以下操作时控制台的外观:
ruby-1.9.2-p180 :026 > user.find_by_name("Test")
NoMethodError: undefined method `find_by_name' for #<User:0x00000100f991a0>
from /Users/easierlife/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activemodel-3.0.7/lib/active_model/attribute_methods.rb:367:in `method_missing'
from /Users/easierlife/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activerecord-3.0.7/lib/active_record/attribute_methods.rb:46:in `method_missing'
from (irb):26
from /Users/easierlife/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.7/lib/rails/commands/console.rb:44:in `start'
from /Users/easierlife/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.7/lib/rails/commands/console.rb:8:in `start'
from /Users/easierlife/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.7/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
ruby-1.9.2-p180 :027 > ^C^C^C^C^C
谢谢
最佳答案
您可以尝试:
exit
,然后按Enter。 关于ruby-on-rails - 错误后退出Rails控制台,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6259654/