Ruby on Rails: Reload Script/Console Without Restarting

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.

  • Revoc3l0t

    You saved my day!

  • Rosalyn

    Hi! I could have sworn I’ve visited this web site before but after looking at many of the articles I realized it’s new to
    me. Nonetheless, I’m certainly pleased I discovered it and I’ll be bookmarking it and checking back frequently!