views:

98

answers:

3

While developing a Rails app, I usually leave the dev server running locally (mongrel) as I work on the code. Changes in the code take affect after a quick refresh. EXCEPT changes havent been taking effect for a class I've been writing in the Lib in folder. Is this in any way a known problem? What could be causing this? It is very frustrating to work on a problem for a while, having no solutions work, only to find out none of those solutions even had a chance to work.

Thanks for any help.

+1  A: 

I've found that there are some folders that the Rails dev server (I use WEBrick) doesn't automatically rescan for changes. The vendor/plugins folder is the one that I know of for certain, but I seem to recall having trouble modifying stuff in the lib folder.

Basically, anytime I modify something outside of app, I restart the dev server.

Eric Perko
thanks.are there any known workarounds other than restarting the server every time?
Not that I have noticed. It seems to me that the rails dev servers only watch the app folder for changes to be reloaded on-the-fly.Maybe there is a config or something you could change for Mongrel, but I'm not familiar with Mongrel.
Eric Perko
+1  A: 

Try looking here for restarting Rails without restarting Mongrel.

kajaco
A: 

In PHP application code is reloaded on every request, this is why you need something like APC to make it fast. Rails has a different model, the application is booted once and can handle multiple requests.

There is a special feature in Rails to reload files that have changed, but it is restricted only to a few directories. Moreover it won't handle changes in code that is invoked during startup (like environment.rb or plugins). In this case you have to restart the server.

The class reload feature is enabled by default in the development environment by the following configuration option

config.cache_classes = false
Adam Byrtek