A little Rails console trick to make you smile

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 code for things like making sure our models have correct associations setup or for quickly creating fancy new records. No need to use the browser. Okay, probably old news…

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

Fool that I was!

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

Doesn’t that make you smile? If not, I present you with a little quote from the Superman:

And those who were seen dancing were thought to be insane by those who could not hear the music.

Sajad Torkamani

Hello! My name is Sajad. I’m a software developer at Nationwide and an aspiring entrepreneur. Originally from Afghanistan, I moved to London at an early age and have been living here for the past 20 years.

This is my personal website where I blog mostly about programming with occasional thoughts on a bunch of other things. I write mainly for my own benefit as I find that writing helps clarify my otherwise very confused thoughts.

Get in touch: sajadtorkamani1@gmail.com