#385 √ resolved
Ruy Asan

Small confusion around config.action_view.cache_template_loading

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

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.

Comments and changes to this ticket

  • Joshua Peek

    Joshua Peek July 12th, 2008 @ 05:54 PM

    • → Tag changed from “” to “actionpack minor railties”
    • → State changed from “new” to “open”
    • → Assigned user changed from “” to “Joshua Peek”
  • Joshua Peek

    Joshua Peek July 12th, 2008 @ 05:56 PM

    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.

  • Joshua Peek

    Joshua Peek July 12th, 2008 @ 08:39 PM

    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.

  • Joshua Peek

    Joshua Peek July 16th, 2008 @ 04:06 AM

    • → 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.

  • adevadeh

    adevadeh September 24th, 2008 @ 11:25 AM

    • → 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.

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Source available from github

Repository is at http://github.com/rails/rails

Check out the development master (Edge Rails):

git clone git://github.com/rails/rails.git

Creating or reviewing a patch

See the contributor guide.

Creating a feature request

Please don't. If you want a new feature in Rails, you'll have to pull up your sleeves and get busy yourself. Or convince someone else to do it. See the contributor guide on how to get going. But posting them here is just going to lead to ticket root.

Creating a bug report

When creating a bug report, be sure to include as much relevant information as possible. Post the code sample that causes the problem. Preferably, alter the unit tests and show through either changed or added tests how the expected behavior is not occuring.

Security vulnerabilities should be reported via an email to security@rubyonrails.org, do not use trac for reporting security vulnerabilities. All content in trac is publicly available as soon as it is posted.

Then don't get your hopes up. Unless you have a "Code Red, Mission Critical, The World is Coming to an End" kinda bug, you're creating this ticket in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the ticket automatically will see any activity or that others will jump to fix it. Creating a ticket like this is mostly to help yourself start on the path of fixing the problem and for others to sign on to with a "I'm having this problem too"..

Shared Ticket Bins