Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

lib nested modules name space clash with models on console (bug or feature?)

#6770

given an AR class like Facility on ./app/models/facility.rb

and a namespaced module in a library with the same name ./lib/extensions/facility.rb
when invoking the Facility constant class name from console

AS loads first the file under the lib, not the model definition class

app/models/facility.rb

class Facility < ActiveRecord::Base
end

lib/extensions/facility.rb

module Extensions
module Facility end end

rails console Loading development environment (Rails 3.0.6)
ruby-1.9.2-p136 :001 > Facility
LoadError: Expected /home/andres/Documents/code/sage/lib/extensions/facility.rb to define Facility

Reported by andres · May 4th, 2011 @ 09:35 PM

State: new
Milestone: none
Assigned to: nobody
Importance: none

Activity

No comments yet.