From: Brian Candler Date: 2010-03-30T23:44:05+09:00 Subject: Re: Using of module and "Is not missing constant" error > I create a test app with this code. > In app/controller/local/class_generator_controller.rb : > > class Local::VerticalGeneratorController < ApplicationController > def index > @models = VerticalBuilder::Vertical.list > @models = VerticalBuilder::Vertical.list #second call raise an > exception > end > end Try rewriting this as: module Local class VerticalGeneratorController < ApplicationController ... end end I have seen similar constant lookup problems before. $ irb --simple-prompt >> class Foo >> ZZZ = 123 >> end => 123 >> class Foo::Bar >> def baz >> puts ZZZ >> end >> end => nil >> Foo::Bar.new.baz NameError: uninitialized constant Foo::Bar::ZZZ from (irb):6:in `baz' from (irb):9 from :0 Compare: $ irb --simple-prompt >> class Foo >> ZZZ = 123 >> end => 123 >> class Foo >> class Bar >> def baz >> puts ZZZ >> end >> end >> end => nil >> Foo::Bar.new.baz 123 => nil -- Posted via http://www.ruby-forum.com/.