我在 RubyMine 的 Rails 控制台中工作了很多,对以下情况感到非常沮丧:
>> User.find_by_name("Joe).id
# Oh no, I forgot the closing double quote marks
# I'll try and cause an exception
>> "
>> ""
>> end
>> exit
# Well this is frustrating...
>> Foo
>> Bar
# rage quit
控制台一直在等待,我只想打破我的表情。我最终必须关闭控制台(或完全关闭 RubyMine)并重新启动它。
有没有更好的解决办法?
最佳答案
在这种特殊情况下,按 Ctrl+d
然后输入括号 )
应该可以:
1.9.3p194 :004 > Team.find_by_name("equipo1).id
1.9.3p194 :005"> cannot get out of here"
1.9.3p194 :006?> hold on...
1.9.3p194 :007 > ^D
1.9.3p194 :007?> )
SyntaxError: (irb):6: syntax error, unexpected tIDENTIFIER, expecting ')'
hold on...
^
(irb):7: syntax error, unexpected ')'
from /Users/dgarcia/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/commands/console.rb:47:in `start'
from /Users/dgarcia/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/commands/console.rb:8:in `start'
from /Users/dgarcia/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
1.9.3p194 :008 > puts "hooray!!"
hooray!!
=> nil
1.9.3p194 :009 >
关于ruby-on-rails - RubyMine 控制台 : Force Ruby/Rails to abort execution of miss typed statements,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11949625/