For those anxiously awaiting my progress reports... (excuse my sarcasm)
Switching my apache+fcgi or lighttpd+fcgi to production mode seems to work
around this problem. Evidently, fcgi does not like development mode?
Perhaps that''s well-known? Perhaps development mode tries to do some
intelligent reloading of rb files. That plus my redefining the namespace
module everywhere confuses someone. Any insights into this would be
helpful, though I''m making progress now.
Also, it appears that calling Breakpoint.activate_drb while in production
mode is a bad thing.
-Tim
> -----Original Message-----
> Sent: Monday, July 25, 2005 7:11 PM
> Subject: [Rails] namespace problems only with fastcgi
>
> Hello everyone. I''m having a fastcgi-only problem. The first
time the
> controller is invoked, it works. Every subsequent time, it fails with:
> "uninitialized constant HopController". Works with cgi.
>
> I''m trying to provide a library of controllers. To reproduce
problem:
>
> ############## config/routes.rb:
> ActionController::Routing::Routes.draw do |map|
> map.installer ''hip'', :controller =>
''music/hip'', :action => ''index''
> map.installer ''hop'', :controller =>
''music/hop'', :action => ''index''
> end
>
> ############## controllers/music.rb:
> require ''hop''
> module Music
> class HipController < ActionController::Base
> def index() render_text "Hip: #{Time.now}" end
> end
> end
>
> ############## controllers/hop.rb:
> module Music
> class HopController < ActionController::Base
> def index() render_text "Hop: #{Time.now}" end
> end
> end
>
> Notice the name of the first controller file is "music.rb". I
> believe rails
> wants it that way because of the Music namespace. Also, if I replace
> "require ''hop''" with the contents of hop.rb, it
works with fcgi.
> So perhaps
> I do not understand how require works? Is my usage of the Music namespace
> incorrect?
>