Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Rails Console command (Rails 3+) to reload changed code?

I am playing with the console, I change some model code and now I want to test it. I normally re-start the console. Is there a quicker way? Maybe a console command to reload the model code?

like image 282
Matteo Melani Avatar asked Jul 06 '11 21:07

Matteo Melani


People also ask

How to reload console in Rails?

Simply type in the “reload!” command after making changes and the console will reload the session. The “reload!” command is limited in the sense that objects that were instantiated before the reload session will only have access to the initial code prior to any changes.

How do you clear a Ruby console?

Clearing the Console You can also use Ctrl + L to clear the screen, which works on both Mac and Linux. If you're on Windows, the only way we're aware of to clear the console is by typing system('cls') . The Windows cls command clears the screen, and the Ruby system method runs that command in a subshell.


1 Answers

Of course, simply type:

reload! 
like image 103
apneadiving Avatar answered Sep 21 '22 19:09

apneadiving