I'm having trouble understanding what initialize_on_precompile
was used for. What exactly did it mean for it to be false (especially as it relates to Heroku)? What did it mean for it to be true?
Apologies if this question is too broad/vague, but I can't seem to find the answer anywhere.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With