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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:44:15+00:00 2026-05-23T16:44:15+00:00

After switching to Rails 3, I noticed that I have to reboot my server

  • 0

After switching to Rails 3, I noticed that I have to reboot my server to make STI model classes reload with each request. For example, suppose I have this:

# app/models/vehicle.rb
class Vehicle < ActiveRecord::Base
end

# app/models/car.rb
class Car < Vehicle
end

If I make a change to Vehicle, the change is loaded on the next request. But if I make a change to Car, I have to reboot my server for it to load.

Any ideas on fixing this?

I’m running WEBrick, but I’m not committed to it.

  • 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-23T16:44:16+00:00Added an answer on May 23, 2026 at 4:44 pm

    We found that we needed both zetetic’s solution and some additional code to make this work (at least in Rails 3.0.9). For the above problem, the solution would look something like:

    In config/environments/development.rb:

      config.after_initialize do
        ["vehicle"].each do|dep|
          require_dependency( (Rails.root + "app/models/#{dep}").to_s )
        end
      end
    

    In app/controllers/application_controller.rb:

    class ApplicationController < ActionController::Base
      if Rails.env == 'development'
        require_dependency( (Rails.root + "app/models/vehicle").to_s )
      end
    ...
    

    The code in development.rb handles the initial loading of the class, and the code in ApplicationController handles subsequent requests.

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

Sidebar

Related Questions

I have a Rails application that unfortunately after a request to a controller, has
I encountered a problem after switching from server-side JavaScript to CoffeeScript in a Node.js
After deploying WCF server (svc) on my Server, I have got this message when
After following the RoR getting started tutorial, I added another model as: $ rails
After switching my Rails 2.3 app from MRI Ruby 1.8.7 to JRuby 1.6.5, the
I use Toast dialogs a lot throughout my application. However, I have noticed that
I'm using Rails 3 to create a project that will need a model called
For some reason I started to get this error after switching to Rails 3.2.
After switching from maven 2 to maven 3 I have found out having 0%
I want to restart my virtual server after switching branches, and tried adding some

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.