0

At work, we have a situation where when

script/server

is run, then all the controller code is cached. This is to speed up the development server. But that will mean that whenever we change the controller code, we need to restart the server.

So we can turn off the caching of controller code all together. But can't there be mechanism that is similar to the inclusion of javascript

foo.js?1275647624   <--- UNIX timestamp

which is to use the cached version as long as there is no code change, but recompile it when there is code change?

Maybe because we use HAML and SASS a lot, loading some page (such as the homepage of the site) can take 40 seconds on the dev environment and it is quite long.

nonopolarity
  • 146,324
  • 131
  • 460
  • 740
  • Woah... 40 seconds for a page?? – Jeriko Jun 04 '10 at 10:42
  • Just for reference, the purpose of the `?timestamp` in your JS / css URLs is to force client browsers to rerequest the file not to use a locally cached version. – Matt S Jun 04 '10 at 14:09
  • The controllers, models, and helpers (basically your app dir) are loaded on a per request basis, modules / libraries are typically cached and require server restarts even in devel. – Matt S Jun 04 '10 at 14:11
  • Analyze your log. It doesn't take 40 seconds to render Haml & Sass! (Haml is nearly as fast as ERB anyway.) – Andrew Vit Jun 20 '10 at 11:31

1 Answers1

1

By default Rails will reload your classes for every request in the development environment. This should ensure that any changes are picked up. Classes are usually only cached when running in the production environment, or possibly if you have a staging environment set up.

Obviously I don't know your application, but 40 seconds to load a home page in development sounds like a long time. Are there any errors in the log?

John Topley
  • 113,588
  • 46
  • 195
  • 237