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

  • Home
  • SEARCH
  • 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 8754455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:37:29+00:00 2026-06-13T13:37:29+00:00

We have a page which shows the top groups for our application. The calculation

  • 0

We have a page which shows the top groups for our application. The calculation of the leader board is expensive so we cache the results for an hour as follows:

@groupboard = Rails.cache.fetch("top_groups", :expires_in => 1.hour) do  
  Group.top_groups
end

This is giving an error after the cache has been written the first time. Poking around in the console I see that Group.top_groups returns an array of items that look as follows:

[#<Group id: 4, name: "IBP", rank: 6, users_count: 13, leader_id: 4662>, 3887]

When I look at the result returned from the cache it looks as follows:

[#<Group id: 4, name: "IBP", rank: 6, users_count: 13, leader_id: 4662>, :@new_record_before_save], false, 3887]

Does anyone know what would be causing @new_record_before_save and the ‘false’ value to be inserted into all the entries for this object in the cache?

We are using Dalli, Memcached 1.4.9, Rails 3.2.4, Ruby 1.9.2

  • 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-13T13:37:30+00:00Added an answer on June 13, 2026 at 1:37 pm

    There is a bug of Rails cache on AR object which has associated object. Try following:

    @groupboard = Rails.cache.fetch("top_groups", :expires_in => 1.hour) do  
      Group.top_groups.map(&:reload)
    end
    

    see more on
    https://github.com/mperham/dalli/issues/250

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

Sidebar

Related Questions

Hi I have a page in my java/jsp based web application which shows list
At current i have an index page which shows values from an XML page
I have a web page with a read-only text box which shows some HTML
I have a protected page which shows data to logged in users only, once
I'm trying to create a leaderboards page which shows the top 10 users depending
I have a page called results.aspx . It shows a list of search results.
I have a page which should show a form with checkboxes, post back if
I have several forms on one page which are submitted using ajaxForm and show
I have a page set up to show only posts from one category, which
I am developing a page in which i have to show video with its

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.