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 5951405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:31:56+00:00 2026-05-22T17:31:56+00:00

I have build an application using inherited_resource plugin and its ready to go into

  • 0

I have build an application using inherited_resource plugin and its ready to go into production.

Now I am looking at ways to implement caching for the same application. As I have some fragments of the page which are dependent on the current_user I am going to use the fragment caching mechanism.

Can someone please provide me with the a pointer or resource which helps in implementing fragment caching for inherited_resource based views and controllers?

Thanks,
Ajay Kumar G

  • 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-05-22T17:31:57+00:00Added an answer on May 22, 2026 at 5:31 pm

    I don’t use inherited_resources, but my understanding is that it’s just a shortcut for controllers. Your views should just be standard, in which case you can use fragment caching as described in the Rails Guide at http://guides.rubyonrails.org/caching_with_rails.html#fragment-caching

    Have you tried that? If that doesn’t work show us what your views look like.


    edit: response to the comment.

    Ah okay, so in general if you are using fragment caching it doesn’t make sense not to call the controller action, because you won’t have any variables set, and if there are no variables then why are you not using page caching?

    In order to prevent queries from firing, ActiveRecord 3.0 with arel is your friend. For instance, if you put @posts = Post.where(:published => true) in your action then it will not be called until you call @posts.each in the view, so if you put that inside the cache block it will never be called. I’m not sure what inherited_resources does by default, but given that it’s written by José Valim I imagine he would be using that feature of ActiveRecord by default, if not it is easy to customize. You can test it out by turning on caching for your development environment and watching the logs to see what queries are being fired.

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

Sidebar

Related Questions

I am using Spring MVC to build my web application, and I have a
I build j2ee application using spring, hibernage-JPA and c3p0 for connection pool. I have
I have a small ajax application built with php. Using phpMyAdmin I have set
I have a legacy VB6 application that was built using MSDE. As many client's
I have an winforms application that was built using MVC. The controller is subscribing
I have an application, built using MVC, that produces a view which delivers summary
I have to build a GUI application on Windows Mobile, and would like it
I'm going to have to build a custom control for a WinForms application. But
I have been asked to build a web application that will be used to
First of all, I know how to build a Java application. But I have

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.