Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Small confusion around config.action_view.cache_template_loading

#385

Changes introduced by "this patch": http://github.com/rails/rails/co... create a small bit of confusion because of the overlap with @config.cache_classes@:

config.cache_classes = true
config.action_view.cache_template_loading = true
# - no STAT call each request, no reloading templates
# - expected behaviour
# - default for prod env

config.cache_classes = false
config.action_view.cache_template_loading = false
# - STATs every request, full view path check every request
# - expected behaviour
# - default for dev env

config.cache_classes = true
config.action_view.cache_template_loading = false
# - STATs every request, but no rechecking process_view_paths
#       i.e. won't discover new files, but will update existing ones
# - pretty much expected behaviour IMO
# - probably quite a rare setup

config.cache_classes = false
config.action_view.cache_template_loading = true
# - no STATs, HOWEVER, process_view_paths gets executed every request...
#     i.e. (Dir.glob("#{dir}/**/*/**") | Dir.glob("#{dir}/**")).each do |file| ...
#     i.e. STAT calls are really not going to be your main problem
# - somewhat confusing because reloading classes doesn't really imply rechecking views
# - but most people won't think this far...
# - also probably quite rare

It's not a big deal, but it seems to be a fairly unnecessary source of potential confusion.

Proposed solution:

  • Rename config.cache_classes to something more all-encompassing like config.reload_app_each_request.
  • Get rid of config.cache_template_loading entirely and have ActionView::TemplateHandlers::Compilable#compile_template? check config.reload_app_each_request directly instead.

I don't think anyone actually needs this level of granularity. "reload_app_each_request" is blunt, but descriptive and easy to reason about.

Reported by Ruy Asan · June 11th, 2008 @ 03:12 AM

State: resolved
Milestone: none
Assigned to: josh josh
Importance: none

Activity

  1. josh
    josh
    • State changed from new to open
    • Assigned user set to josh
    • Tag set to actionpack, minor, railties

    July 12th, 2008 @ 05:54 PM

  2. josh
    josh

    Wait a few more days, then we'll discuss again. I'm putting in another large view path/compiling patch.

    I do agree w/ you though.

    July 12th, 2008 @ 05:56 PM

  3. josh
    josh

    Big change -http://github.com/rails/rails/co...

    Another thing that should happen. Template attributes should be lazy loaded in development and eager loaded and frozen in production.

    I'm sort of thinking they should all be stuff under cache_classes.

    July 12th, 2008 @ 08:39 PM

  4. josh
    josh
    • State changed from open to resolved

    I'm going close this for now. I may open a thread on the mailing list if I'm not sure what I'm going to do. I'll get to it soon though.

    July 16th, 2008 @ 04:06 AM

  5. adevadeh
    adevadeh
    • Tag changed from actionpack, minor, railties to actionpack, minor, railties

    not sure what is happening with this ticket, but just FYI: we have a setup where the app classes need to stay around, but we would really like to reload the views (the third option listed). Merging the two options into a single one causes problems what we could only workaround by hacking Rails.

    September 24th, 2008 @ 11:25 AM

  6. Stephen Reid
    Stephen Reid

    I too have been using the third option. Having just upgraded to 2.2.2 I am disappointed to see I can no longer reload views without reloading the entire app (reloading the entire app is slow in Windows =/). Can we reintroduce some way of accomodating this?

    January 20th, 2009 @ 01:19 AM

  7. Eric Mill
    Eric Mill

    Who says "I'll get to it soon, but until I do, I'm marking it resolved"??

    October 3rd, 2009 @ 02:32 AM

  8. Ruy Asan
    Ruy Asan

    Just FYI, cache_template_loading has indeed been removed in favor of simply cache_classes. 'Case google brought you here and are wondering.

    I still think the name is less then ideal because views != classes grumble grumble but we'll live.

    June 11th, 2010 @ 11:46 PM

  9. ssupreme11
    ssupreme11
    • Importance changed from to

    Its my first time to visit this site and as I was exploring I cant believe that this site was made up of a very informative articles that you should try to have compliment with so as what I am doing now I really love to look forward with more interesting information on this site.. Custom Dissertation Writing

    May 10th, 2011 @ 10:38 PM

  10. KMike
    KMike

    Dear Ruy,

    We get the same error in our workspace database and for whatever reason on PC geek cannot fix it. How do I contact your (PM?) to get help? Please, let me know. Thanks a mill!

    Mike
    college essay help

    May 18th, 2011 @ 05:46 PM