Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exiting the Rails console after an error

I have been use the rails console for testing and learning purposes and when I encounter an error I cannot exit anymore using the "Control + C" command. Is there another command to exit? This is what the console looks like when I try to do this:

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 

Thanks

like image 557
EverTheLearner Avatar asked Jun 07 '11 00:06

EverTheLearner


People also ask

How do I get out of rails console?

To exit the console, type: quit .

How do I open the Rails console in Terminal?

Go to your browser and open http://localhost:3000, you will see a basic Rails app running. You can also use the alias "s" to start the server: bin/rails s . The server can be run on a different port using the -p option. The default development environment can be changed using -e .


1 Answers

You could try:

  • Ctrl D
  • Ctrl Z and then Enter
  • Typing exit, then Enter.
like image 97
Zabba Avatar answered Oct 08 '22 04:10

Zabba