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?

Aaron

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 B. wrote:

Did I jump on 1.2 too early?

Aaron

Have you seen this from:
Ruby on Rails — Rails 1.2: REST admiration, HTTP lovefest, and UTF-8 celebrations

[blockquote]
Auto-loading

We’ve fixed a bug that allowed libraries from Ruby’s standard library to
be auto-loaded on reference. Before, if you merely reference the
Pathname constant, we’d autoload pathname.rb. No more, you’ll need to
manually require ‘pathname’ now.

We’ve also improved the handling of module loading, which means that a
reference for Accounting::Subscription will look for
app/models/accounting/subscription.rb. At the same time, that means that
merely referencing Subscription will not look for subscription.rb in any
subdir of app/models. Only app/models/subscription.rb will be tried. If
you for some reason depended on this, you can still get it back by
adding app/models/accounting to config.load_paths in
config/environment.rb.
[/blockquote]

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.

This is a long shot, installed 1.2.1, but in my app that matters, server
won’t start (will start with other apps):
** Starting Rails with development environment …

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:377:in
new_constants_in': You have a nil object when you didn't expect it! (NoMethodError) You might have expected an instance of Array. The error occurred while evaluating nil.empty? from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:203:inload_file’
from
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:95:in
require_or_load' from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:61:independ_on’
from
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:443:in
require_dependency' from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/helpers.rb:67:inhelper’
from
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/helpers.rb:58:in
helper' from C:/InstantRails/rails_apps/pazap/config/../vendor/plugins/debug-view-helper/lib/view_debug_helper.rb:94 from C:/InstantRails/rails_apps/pazap/config/../vendor/plugins/debug-view-helper/lib/view_debug_helper.rb:93 ... 20 levels... from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/lib/mongrel/command.rb:199:inrun’
from
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.13.3-mswin32/bin/mongrel_rails:235
from C:\InstantRails\ruby\bin\mongrel_rails:18
from -e:3

is it perhaps running into a plugin it doesn’t like? Anyone else having
this error?

Hey

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:

Regards,
Gustav P.

Aaron B. wrote:

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)

I was having this error with the railsdav plugin. I was able to fix it
by adding a line that says require “railsdav” to the
vendor/plugins/railsdav/init.rb

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?

On Fri, 2007-01-19 at 18:27 +0100, Tony B. 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.

Thoughts?

matt

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

default_value
enum-column
engines (required by datebocks_engine)
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.

Chris

matt wrote:

On Fri, 2007-01-19 at 18:27 +0100, Tony B. 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.

Thoughts?

matt

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.

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:
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/
efeb1eacdf81a0b5/b1eab53f3986b0c5#b1eab53f3986b0c5

Chris wrote:

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

default_value
enum-column
engines (required by datebocks_engine)
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’ve seen the same thing. What solved it for me was to change the
directory names with dashes (-) in them, to use underscored (_) instead.
So enum_column instead of enum-column.

Regards,

Arjen

On Sun, 2007-01-28 at 07:16 +0100, Chris wrote:

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


please do because I’m going to have to travel this path soon myself and
I do use toolbocks (and obviously engines)

Thanks

Craig