Rails 3: Faster startup by not eager loading engines

Engine eager load by default on rails 3, so lets turn that off to save some precious startup time.

# config/environments/test.rb + development.rb
config.eager_load = false
# config/application.rb
if !config.eager_load && Rails::VERSION::MAJOR == 3
  Rails::Railtie.descendants.each do |railtie|
    railtie.class_eval { def eager_load!; end }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s