LoadErrors in Rails 1.2

These errors did NOT occur in the release candidate #2.

`load_missing_constant’: Expected /Users/baldwina/svn/xxxx/trunk

/config/…/lib/customer.rb to define Customer (LoadError)

The customer.rb
file does define class Customer.

Here is another example:
LoadError: Expected /Users/baldwina/svn/xxxx/trunk/config/…/app/models/status.rb to define Status

Again, status.rb does define Status.

Did I jump on 1.2 too early?


I'm seeing the same thing. It happens in tests. Also happens on 1.2.1. Works fine in RC2 and 1.1.6.

This seems to be related to referring to the class in question from
environment.rb . Commenting out the sections of custom code in
environment.rb solves the problem, but now parts of the rest of the app
don't work anymore since certain things weren't setup right in
environment.rb. Any suggestions would be appreciated.

I see a different error when trying to start the server, but commenting
out the same lines in environment.rb fixes that too.

Aaron Baldwin wrote:

I don't think this is it.

All the people I've seen complaining of this is with loading models and
controllers, which isn't affected by what you mention here.

It's finding the correct file to load what it is looking for, it's just
claiming the class doesn't exist in that file when it does.


Could you post your environment.rb file to the list with the offending
methods included? Providing they aren't sensitive to our scrutiny :slight_smile:

Gustav Paul

Jon Garvin wrote:

I've noticed that my problem with loading models is only in the
development environment. Specifically, if I turn on the caching of
loaded classes in config/environments/development.rb
(config.cache_classes = true) my problem goes away. (Not really since
it I want to not cache the classes in dev.)

Is your problem occuring regardless of the cache setting? Or does the
cache setting impact what occurs?

Andrew Selder wrote:

per Alan's reply, I added a few strategic requires and that seems to
have greatly improved the situation. Server starts now, but now there
are other errors indicating I still have more to do. Thanks all for the
assistance. I think I can take it from here.

Gustav Paul wrote:

Was there ever a final answer on this?

I too have a 'expected customer.rb to define Customer' error, when I can
see darn well that it's defined.

this is in a rails engine, if that matters and my init_engine.rb does
include the engine.



Same problem here. It's definitely plug-in related, and it's one of
these (I only had the following plugins included):

engines (required by datebocks_engine)

I'm still trying to nail this down, but I'm guessing it's engines based
on how much munging it must do.

I'll post as soon as I have a more conclusive answer.

As posted to this list a while back, I'm currently soliciting feedback
on the upcoming 1.2 release of the engines plugin, which is compatible
with Rails 1.2. The "official" release (the one you get at the moment
when running script/plugin install engines) is NOT compatible.

You can find the current 1.2 release branch at http://svn.rails-
engines.org/engines/branches/rb_1.2 - checkout this code into vendor/
plugins for a 1.2-compatible version of the engines plugin.

You should also be aware that until the "datebocks" plugin is updated
to be compatible with the engines 1.2 release, it will (probably) not
work properly.

- James

Looks like we having similar issues: