0

I know if I make a change to a Rails\Ruby application that restarting mongrel is required to see the changes take effect. I was just curious if mongrel actually uses a compiled version of the application rather than interpreting it on the fly like say PHP is usually done?

Joshua Enfield
  • 3,454
  • 8
  • 42
  • 59

3 Answers3

2

When running in the Development environment, you do not need to restart Mongrel to have changes in the source applied immediately (Rails checks if the source file of any class descended from one of the Rails classes has changed before using that class).

When running in the Production environment, you must restart for every change.

In all cases, if the file is not one that Rails knows about (e.g. your own module or class) or is a configuration file then you must restart Mongrel to have the change take effect.

Note that this is a feature of Rails, not Ruby

Chris McCauley
  • 552
  • 1
  • 5
  • 15
1

To answer part of the question - no, Ruby does not get compiled into any sort of intermediate file-based bytecode (unlike, say, Java's class files). But as Chris said, when running Rails in production mode you do have to restart the process to reload the source code.

One advantage of using Passenger vs Mongrel is that with Passenger you can cause the application to be restarted on the next HTTP request by doing a touch tmp/restart.txt in the application's current/ directory.

tomcopeland
  • 171
  • 2
0

I believe that it's not compiled, but that certain files (such as database.yml and routes.rb) are only read at startup. If you change (for example) a view then the change should take effect immediately.

hmallett
  • 2,455
  • 14
  • 26