Undefined class/module

Hi,

We are running a Rails application in development mode. Intermittenly we
get an error on some pages, saying : undefine class/module User. If we
refresh the page, the error goes away and we see the html correctly
rendered. User is a model defined in the models directory and has been
listed in application.rb as model :user.

I am suprised by the fact that this happens only occasionally. Can
someone suggest what might have gone wrong?

Thanks,
Yash

Yash wrote:

Hi,

We are running a Rails application in development mode. Intermittenly we
get an error on some pages, saying : undefine class/module User. If we
refresh the page, the error goes away and we see the html correctly
rendered. User is a model defined in the models directory and has been
listed in application.rb as model :user.

I am suprised by the fact that this happens only occasionally. Can
someone suggest what might have gone wrong?

Thanks,
Yash

I have seen this problem too. It seems to happen when the system is
under heavy load. I suspect that the reflection technique used to
get the table details is hitting some timeout when trying to access
the database.
The environment where it occasionally occurs for me is
– Development mode, Rails 1.0, Ruby 1.8.4
– Linux
– Postgres
– Webrick using SSL
– Heavy load

My questions:
If a timeout occurs on db access, shouldn’t Rails just retry later?
(that would be the robust thing)
How can development mode cause this kind of error? (makes things slower,
yes … but they shouldn’t break).

– Mike B.

phoenix wrote:

l right when this Controller be called the first time,then it
will nerver run,just raise this exception:undefined class/module Cring
After restart my Webrick,it will be right just once,then raise
exception!

I had similar errors until I updated to Rails 1.2RC2.

Mike B. wrote:

Yash wrote:

Hi,

We are running a Rails application in development mode. Intermittenly we
get an error on some pages, saying : undefine class/module User. If we
refresh the page, the error goes away and we see the html correctly
rendered. User is a model defined in the models directory and has been
listed in application.rb as model :user.

I am suprised by the fact that this happens only occasionally. Can
someone suggest what might have gone wrong?

Thanks,
Yash

I have seen this problem too. It seems to happen when the system is
under heavy load. I suspect that the reflection technique used to
get the table details is hitting some timeout when trying to access
the database.
The environment where it occasionally occurs for me is
– Development mode, Rails 1.0, Ruby 1.8.4
– Linux
– Postgres
– Webrick using SSL
– Heavy load

My questions:
If a timeout occurs on db access, shouldn’t Rails just retry later?
(that would be the robust thing)
How can development mode cause this kind of error? (makes things slower,
yes … but they shouldn’t break).

– Mike B.

I am under ruby 1.8.5,rails 1.1.6,Development mode,system is not under
heavy load:
require ‘Cring’
class QueryController < ApplicationController

@@score_cache ||= File.zero?(‘score.cache’) ? Hash.new :
Marshal.load(@@f)

It’s all right when this Controller be called the first time,then it
will nerver run,just raise this exception:undefined class/module Cring
After restart my Webrick,it will be right just once,then raise
exception!