Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #1173 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

[PATCH] All modules should be able to load missing constants

Reported by: anonymous Assigned to: David
Priority: low Milestone: 1.0
Component: ActiveSupport Version: 0.12.1
Severity: blocker Keywords: loader dependency module model
Cc:

Description

I have (had!) a class BasicRecord that include Versionable and Linkable in modules called "versionable.rb" and "linkable.rb". The modules refer to another model class, Type in "type.rb".

All works fine in unit and functional tests, also in the script/console, but not with script/server where I get a stack dump indicating that "Linkable::Type" is an unknown Constant.

It doesn't help to "require 'type'" from linkable.rb. But doing so does move the stackdump to another place in the code that refers to Type.

I don't understand the loader enough to tackle this one. Hope it makes some kind of sense to someone out there. Workaround is to dump all my module code direct in the base class (which I don't especially like).

Attachments

fix_const_missing_inside_module.patch (2.3 kB) - added by Ulysses on 05/12/05 19:17:10.
Patch adding modified method_missing to all Module instances

Change History

04/23/05 17:45:29 changed by nzkoz

  • milestone set to 1.0.

After discussing with david hh, I'm moving this into a 1.0 blocker

05/12/05 17:24:25 changed by ulysses

module Linkable
  CheckItOutItWorks = ::Type
end

Good enough?

05/12/05 19:17:10 changed by Ulysses

  • attachment fix_const_missing_inside_module.patch added.

Patch adding modified method_missing to all Module instances

05/12/05 19:17:48 changed by ulysses

  • summary changed from Using modules included in models gets the loader confused to [PATCH] All modules should be able to load missing constants.

05/19/05 19:17:18 changed by david

  • status changed from new to closed.
  • resolution set to fixed.