Reload the rails console

Yes, you need to call reload! as this will clear the loaded constants that have been loaded and will load them as they’re referenced in the console.

If you have old objects from before the reload! you will need to call reload on these individual objects or find new objects and work with them if you want to try out the new method.

As an alternative, I would really recommend looking into a testing framework such as RSpec which gives you repeatable tests and a safety net for your application.

It looks like you’re trying to use the console as a testing tool for new functionality in your application, which is what RSpec is better suited for. The console is really good for experimentation.

Leave a Comment