Rails: How to undo the current instructions in the rails console?

I am using Rails 2.3.8 with jRuby for a project. and I regularly use rails consoleto test my classes and APIs, somewhere I have one problem. when I work in the Rails console, if I mistakenly enter several multi-line commands, is there a way to cancel it somewhere in the middle?

eg:.

>> [1,2,3,4].inject(1){
?>

All I found will be expecting me to finish the whole completed expression, but all I want to do is cancel all current statements.

I tried Ctrl + C, but this did not work for me.

Any advice would be greatly appreciated.

+5
source share
1 answer

At the command line, you can use the following command to manage your irb session.

conf.ignore_sigint= true/false

^ C (control-c). false, ^ C irb. true, ^ C ; ^ C .

rails IRB. .:

http://www.rubycentral.com/pickaxe/irb.html

rubycentral.com .

+4

All Articles