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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:48:05+00:00 2026-05-11T18:48:05+00:00

I am facing an issue where my Rails application is set to cache classes

  • 0

I am facing an issue where my Rails application is set to cache classes when run in the staging or production environment. While load_paths only contains ‘app/models’, it appears that the initialization steps recursively caches everything in ‘app/models’.

  # Eager load application classes
  def load_application_classes
    if configuration.cache_classes
      configuration.eager_load_paths.each do |load_path|
        matcher = /\A#{Regexp.escape(load_path)}(.*)\.rb\Z/
        Dir.glob("#{load_path}/**/*.rb").sort.each do |file|
          require_dependency file.sub(matcher, '\1')
        end
      end
    end
  end

The problem in this is that we have a sub directory within ‘app/models’ that contains files with require statements that reference a concurrent JRuby environment. Since Rails knows nothing of this environment our application breaks on load.

As it stands, here are the proposed solutions…unfortunately only #1 is ideal.

1) The simplest solution would be to exclude the culprit sub directory, but have not found anything how to accomplish this.

2) Monkey patch the load_application_classes method to skip the specific sub directory.

3) Move the sub directory out from under ‘app/models’. Feels a bit hackish and would require quite a few code changes.

Thoughts?

  • 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-11T18:48:06+00:00Added an answer on May 11, 2026 at 6:48 pm

    As a temporary measure you could go with a version of option 2 and override the definition of load_application_classes, replacing it with an empty implementation. That would force you to explicitly require the classes you need but it would give you complete control over what gets loaded and would be a completely transparent solution.

    It sounds like your application is sufficiently sophisticated that it’s growing beyond the Rails framework. I know that this doesn’t directly answer your question so appologies in advance but you may want to consider looking at an alternative Ruby framework like Merb. Rails is great but sooner or later you bump into edge of the framework – sounds like that’s where you are now.

    We made the switch to Merb last year and haven’t regreated it.

    Chris

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

Sidebar

Ask A Question

Stats

  • Questions 151k
  • Answers 151k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer if you choose to set the Cascade parameter at NONE,… May 12, 2026 at 9:58 am
  • Editorial Team
    Editorial Team added an answer Microsoft.VisualBasic.FileIO is built on top of System.IO (for the most… May 12, 2026 at 9:58 am
  • Editorial Team
    Editorial Team added an answer extern is needed because it declares that the symbol exists… May 12, 2026 at 9:58 am

Related Questions

Let's say we have an entity that has attributes att1 and att2, where att1
I am facing some issues while serializing objects (I am using JBoss Drools, and
I have been working on on an AJAX chat application using php, mysql. It's
This is almost similar question to this one: - Dealing with timezones in PHP

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.