What exactly was initialize_on_precompile used for? What exactly was initialize_on_precompile used for? heroku heroku

What exactly was initialize_on_precompile used for?


This option was available till Rails 3.x as when you run rake assets:precompile it initializes the application and tries to connect to the database. So setting this option to false prevents it. So if you have any issues in connection to the database rake assets:precompile won't work and fail this option ensures that it will work.

From Rails Git Repo:

The initialize_on_precompile change tells the precompile task to run without invoking Rails. This is because the precompile task runs in production mode by default, and will attempt to connect to your specified production database. Please note that you cannot have code in pipeline files that relies on Rails resources (such as the database) when compiling locally with this option.

In Rails 4.x this option has been removed and is no longer required. Rails 4 now always loads initializers and the database configuration before precompiling assets

Source of Commit: https://github.com/rails/rails/commit/2d5a6de