This project is archived and is in readonly mode.

#260 ✓committed
Rich Bradley

ActiveRecord: nested "include" hints fail if record classes are in modules

Reported by Rich Bradley | May 27th, 2008 @ 12:17 PM

ActiveRecord 2.0.2 can't load records whose classes are in modules when using nested "include"s.

e.g.

@edition = Edition.find_by_id(edition_id, {:include => {:published_item => :user}})

gives an error:

C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:266:in

`load_missing_constant': uninitialized constant PublishedItem (NameError)

This appears to be because "constantize" is called on the string "PublishedItem", which isn't a constant, although "YuduLibrary::Model::PublishedItem" is.

I've attached a monkey patch which I'm currently using to work around the problem.

I would submit a proper patch to fix the issue, but I can't get the ActiveRecord unit tests to run on my machine (win32).

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>