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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:13:31+00:00 2026-05-17T16:13:31+00:00

I have an app that heavily relies on dates. There is a moderately expensive

  • 0

I have an app that heavily relies on dates. There is a moderately expensive calculation that is needed to set these dates, based on the current date. As far as each request is concerned, these dates are constants — they don’t change once created — but they do change throughout the week. The dates are used in both controllers and models.

My problem is this:

  • if the dates didn’t change each day, I could set them in config/initializers. But initializers are only evaluated when the server restarts
  • if i set the dates in applicationController using before_filter, the dates aren’t available to my models

Any ideas? Am I looking at this all wrong? 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-05-17T16:13:32+00:00Added an answer on May 17, 2026 at 4:13 pm

    I think that here you can use Rails caching. Look here and here for more details and examples.

    Basicaly, you can write to cache:

    Rails.cache.write('date', Date.today)
    

    and read:

    Rails.cache.read('date')
    

    You can use it in whole Rails application (models, views, controllers, …).

    You can store any object in cache. Default caching uses memory and is availble for single Rails instance, however you can use different cache storing method.

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

Sidebar

Related Questions

I have an iPhone app that heavily relies on the OpenCV library; as such,
I have this c# web app that relies heavily on two dll files that
I have an app that relies heavily on JSON responses from a webservice. All
I have an app that's heavily form-based. Many of the forms are constructed exactly
I have a web app that I am developing that relies heavily on absolute
I am developing an app that relies heavily on an external dll, my app
I'm working on an iPhone App that relies heavily on OpenGL. Right now it
I have a local development environment that relies heavily on system environment variables (it
I have these DataGridViews, used pretty heavily in my app to show lists of
I have an app I'm developing which relies heavily on users being able to

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.