Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8204273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:50:52+00:00 2026-06-07T07:50:52+00:00

I have a little interactive script for doing a bunch of things with my

  • 0

I have a little interactive script for doing a bunch of things with my Rails app. Generally I run this with the cache_classes config option disabled so that I can modify and reload views without having to restart it however certain tests will only work with cache_classes enabled. In particular integration tests exhibit very strange behaviour when cache_classes is disabled.

Ideally what I would like to do is to be able to turn cache_classes on and off from within the script without restarting the script but whilst I can update the value of this variable, it doesn’t have any effect.

Does anyone know of a way to dynamically update cache_classes?

Alternatively, if there is a way of telling rails about view changes whilst cache_classes is on, that would be even better as then I could leave cache_classes permanently on.

Many thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T07:50:54+00:00Added an answer on June 7, 2026 at 7:50 am

    For the benefit of anyone else who may have this issue, there is a relatively straight forward way of using a custom method to determine whether views should be cached.

    First we need to override a method in the ActionView::Resolver class as follows

    module ActionView
      class Resolver
        def caching?
          @caching = some_custom_method
        end
      end
    end
    

    Then we can use our custom method to turn the view caching on and off depending on whatever criteria we want.

    I’ve posted this in the hope of saving someone else a big dig through the Rails source code but there are a few caveats:

    a) I have only checked this on Rails 3.0.14 as that is the current version that is applicable to me now. It may or may not work on other versions.

    b) If you put a slow method in here you will absolutely kill your performance as this method will get called a lot of times per request. I am happy to do this since in my case the code is only being used in my local test environment and I have to explicitly include it when I want it, but personally, I probably wouldn’t have the balls/stomach to put something like this in production code.

    Hope this helps someone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have little question about how web browser retrieve webpage? I know this User
I have little question. I found this on internet: Type t = typeof(MyClass); MethodInfo[]
There's a little script that grabs a bunch of data from a database, and
I have an little script which logs users that login to my Pidgin/MSN account
I'm building a little synth app/music toy which uses soundFonts. I have a varying
I have a few little custom dialogs in my app, and they are kinda
I have an app that has a bunch of resources. Having read about javascript
I have little unusual problem to solve. I need some hint or links to
I have little bit longer question for you - but hope answer will be
I have little doubt about string reading in C. string reading functions like gets,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.