Can Rails console reload modules under lib?

I have a module in my Rails project under lib. I run 'rails c' and do some experimenting in the console. I make a change to the module under lib, type 'reload!' from the console and it doesn't reload the file. I have to quit the console and restart, which is real pain.

Is there a better way to reload that file?


Solution 1:

Try this:

load "#{Rails.root}/lib/yourfile.rb"

Solution 2:

In case anyone interested, here's my findings on how to auto-reload require files in Rails without restarting server.

The solution is now available as a Ruby gem require_reloader.