difference between three development modes in rails
What are the difference between three modes in rails like:-
In development mode, Rails reloads models each time a browser sends in a request,
so the model will always reflect the current database schema.
EDIT I was asking about the other differences. I mentioned one i was looking for other 开发者_StackOverflow中文版list of differences...!!
It comes down to performance and stability. In production mode, model are cached in memory, meaning that once they have been read once, the files don't have to be read again, bringing an obvious speed benefit. This means that if you were to alter the ruby file (eg app/models/page.rb) where a model is defined, this change would not be picked up until the next reload.
By default, the following line is found in config/environments/production.rb:
config.cache_classes = true
The assumption is that when you're in production mode, you won't be changing your code other than via a release or deployment. If you want to clear the cache, you need to restart the application.
The development environment will reload your models each time it receives a request. This is controlled by the following default line in config/environments/development.rb:
config.cache_classes = false
In terms of the 'third' mode, I presume you mean test mode. This also caches models by default (see config/environments/test.rb), again with the assumption that you won't be altering your codebase mid-way through a test run.
Btw, it's not just models - I'm pretty sure that this setting encompasses any classes found within the 'app' directory. In addition, you will find that, even in development mode, classes located elsewhere in the application (eg 'lib') can not be changed without restarting the application.
The behavior of the three modes is configured in:
rails_app/config/environments/[production|development|test].rb
So, it depends on your configuration how the three modes are different.
精彩评论