title: Why does code need to be reloaded in Rails 3?
body: <p>I am a former PHP developer learning Rails and Sinatra. In PHP, every page request loaded all of the required files. If I changed some code and refreshed the page, I could be sure that the code was fresh.</p>
  
  <p>In Rails 3, Controller code is fresh on every request. However, if I modify any code in the /lib folder, I need to restart the server so the changes take effect.</p>
  
  <p>Why does this happen? Is it something to do with the way Ruby is designed?  Is Rails doing some optimizations to avoid reloading code on every request?</p>
  
  <p>Thanks!</p>
  
  <p>Edit: I am mostly interested in what is going on under the hood. Do frameworks like Rails and Sinatra do some special caching for classes? If so, what does they do? Is the default behavior in Ruby that all code gets reloaded on every request? Why do we need tools like Shotgun for Sinatra (<a href="http://sinatra-book.gittr.com/#automatic_code_reloading">http://sinatra-book.gittr.com/#automatic_code_reloading</a>)?</p>