sajad torkamani

Rails being the wonderful framework that it is, we can execute rails console from the command line to enter IRB with our Rails application preloaded.

This allows us to interactively test our application code by doing things such as checking if our models have the correct associations setup or for quickly creating new records for debugging purposes. All this without clicking around in the browser. Okay, probably old news...

Well, up till now, every time I made some change in the application code and wanted to test the change in the Rails console, I'd exit the Rails console and rerun rails console in order to have the new changes take effect.

Fool that I was!

Instead, we can just run reload! directly inside the Rails console to have the new changes be loaded without having to exit and re-enter.

This means we can have a Rails console session open, update our code in our editor, run reload! from the console, and test our changes. That enables some rapid prototyping!

Tagged: Rails