title: Reload lib files without restart dev server in Rails 3.1
body: <p>I have some modules inside the lib folder in rails i.e.:</p>
  
  <blockquote>
    <p>/lib/myapp/lib/**</p>
  </blockquote>
  
  <p>I am working on them in development, however each time I have to restart server. I have been through a number of different questions on SO but most of them are for not for rails 3.1</p>
  
  <p>I currently have an initializer that does this;</p>
  
  <pre><code>if Rails.env == "development"
    lib_reloader = ActiveSupport::FileUpdateChecker.new(Dir["lib/**/*"], true) do
      Rails.application.reload_routes! # or do something better here
    end
  
    ActionDispatch::Callbacks.to_prepare do
      lib_reloader.execute_if_updated
    end
  end
  
  if Rails.env == "development"
    lib_reloader = ActiveSupport::FileUpdateChecker.new(Dir["lib/myapp/lib/*"], true) do
      Rails.application.reload_routes! # or do something better here
    end
  
    ActionDispatch::Callbacks.to_prepare do
      lib_reloader.execute_if_updated
    end
  end
  </code></pre>
  
  <p>Is there a generic way to do this? Its very time consuming having to restart the server every single time!</p>