Browse files

documents config.assets.initialize_on_precompile in the asset pipelin…

…e guide
  • Loading branch information...
1 parent c1547fc commit 6e00c05607c03eead00966a5de4769b2e77af196 @fxn fxn committed Oct 2, 2011
Showing with 7 additions and 0 deletions.
  1. +7 −0 railties/guides/source/asset_pipeline.textile
@@ -346,6 +346,13 @@ The rake task is:
bundle exec rake assets:precompile
+Asset templates in general have access to application objects. You may prevent application
+initialization in precompilation setting +config.assets.initialize_on_precompile+ to false.
+WARNING: Application objects may still be in scope in asset templates in develoment mode.
+If +config.assets.initialize_on_precompile+ is set to false it is your responsability not
+to use them at all.
Capistrano (v2.8.0 and above) has a recipe to handle this in deployment. Add the following line to +Capfile+:

3 comments on commit 6e00c05


jeremy replied Oct 2, 2011


Could say for "For faster asset precompiles, you can partially load your application by setting +config...+ to false. Heroku requires this to be set to false."

And a big "WARNING: if you set this to false, be sure to test rake assets:precompile locally before deploying to Heroku. It may expose bugs where your assets reference your app's models and methods."


fxn replied Oct 2, 2011

Thanks Jeremy, I've reworded that :).

For me the sentence "since [application objects and methods] are still in scope in development mode regardless of the value of this flag" is a smell... perhaps it is easier to document than to make it consistent.


fxn replied Oct 2, 2011

Oh, the rewording is d94aa10

Please sign in to comment.