Ruby on Rails: Reload Script/Console Without Restarting

Contributor Icon Contributed by johnnythawte  
Tag Icon Tagged: 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]
>>

 

1 Comment -


  1. Revoc3l0t said on April 12, 2011

    You saved my day!

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -