Is it true that the standard way to say "cache all Model, View, Controller code" when running the Rails server, by using the following line in config/environments/development.rb
config.cache_classes = true
and for don't cache any of them:
config.cache_classes = false
and to "selectively" cache any one of them, use the above false
line, and in config/environment.rb
:
config.load_once_paths += %W( #{RAILS_ROOT}/app/models )
which will only cache the Model code. And to cache Controller code or View code, just add either
#{RAILS_ROOT}/app/controllers
or
#{RAILS_ROOT}/app/views
to inside the %W{ }
. For example, if we are only developing the Views (HTML and CSS), then there is no need to reload
Model and Controller code when running the server, so set load_once_paths
for Models and Controllers,
and just let the View code load every time? (is there docs that talk about this?)
Well, there is no documentation that explains this in detail, but you can read about rails configuration here : http://guides.rubyonrails.org/configuring.html
As for your question, You are absolutely correct :).
use
config.load_once_paths
to cache selectively ( Obviously withconfig.cache_classes = false
)And use
config.cache_classes = true
to cache everything