Please sign in to comment.
Allow users to choose when to eager_load the application or not.
Previously, the eager load behavior was mostly coupled to config.cache_classes, however this was suboptimal since in some environments a developer may want to cache classes but not necessarily load them all on boot (for example, test env). This pull request also promotes the use of config.eager_load set to true by default in production. In the majority of the cases, this is the behavior you want since it will copy most of your app into memory on boot (which was also the previous behavior). Finally, this fix a long standing Rails bug where it was impossible to access a model in a rake task when Rails was set as thread safe.
- Loading branch information...
Showing with 67 additions and 8 deletions.
- +9 −1 railties/lib/rails/application.rb
- +14 −1 railties/lib/rails/application/bootstrap.rb
- +3 −3 railties/lib/rails/application/configuration.rb
- +2 −2 railties/lib/rails/application/finisher.rb
- +3 −0 railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt
- +6 −0 railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
- +5 −0 railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt
- +24 −0 railties/test/application/rake_test.rb
- +1 −1 railties/test/isolation/abstract_unit.rb