Ruby on Rails: Reload Script/Console Without Restarting

Posted December 6, 2006 by johnnythawte in Ruby on Rails

When you are testing your rails application using script/console, you have to stop and start the console to test changes to your model objects. This recipe shows you the easy way to reload the console.


If you are using windows, you start the console by using this command: ruby script\console
Linux:./script/console

Just use the following command whenever you make changes to your model objects:
reload!

Here’s an example:
?> reload!
Reloading…
=> [Article, User, ApplicationController]
>>

The Conversation

Follow the reactions below and share your own thoughts.