# Rails & Mongrel & Lighttpd \> NameError in Production

**URL:** <https://www.ruby-forum.com/t/rails-mongrel-lighttpd-nameerror-in-production/98963>\
**Category:** Rails\
**Created:** [July 19, 2006, 12:02pm UTC](https://www.ruby-forum.com/t/rails-mongrel-lighttpd-nameerror-in-production/98963 "2006-07-19T12:02:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![none](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f19dbf/32.png) [@none](https://www.ruby-forum.com/u/none)\
**Post date:** [July 19, 2006, 12:02pm UTC](https://www.ruby-forum.com/t/rails-mongrel-lighttpd-nameerror-in-production/98963/1 "2006-07-19T12:02:23Z")

</div>

hallo there,

i got a problem with switching from development- to production-mode in  
my rails project. in development everything is working fine, but in  
production i keep on getting a NameError…

> [@](#):
>
> NameError in Appointments/admin/appointment categoryController#list  
> uninitialized constant Appointments::Admin::AppointmentCategory
> 
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:100:in  
> `const\_missing’
> 
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:133:in  
> `const\_missing’
> 
> #{RAILS\_ROOT}/app/controllers/appointments/admin/appointment\_category\_controller.rb:10:in  
> `list’  
> /usr/bin/mongrel\_rails:18

why is that? has anyone got a clue what reason there could be for an  
error like that?

maybe a problem with mongrel? in development i’m using the built-in  
webrick-server. for production i’m running mongrel on a debian 3.1  
system.

Debian Sarge 3.1  
Rails 1.1.2  
mongrel (0.3.13.3)  
mongrel\_cluster (0.2.0)  
sendfile (0.9.2)  
lighttpd-1.4.11

thanks in advance for any replies!  
none

---

<div class="post-metadata">

**Author:** ![none](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f19dbf/32.png) [@none](https://www.ruby-forum.com/u/none)\
**Post date:** [July 19, 2006, 6:11pm UTC](https://www.ruby-forum.com/t/rails-mongrel-lighttpd-nameerror-in-production/98963/2 "2006-07-19T18:11:24Z")

</div>

it’s me again,

i found that it doesn’t change a thing if i run my rails app in  
production mode on a webrick-server on my home-machine (suse 10.1). so  
it’s NOT a mongrel/lighttpd related problem!

seems like there a re problems with my models being nested in a  
subfolder. for example:

> [@](#):
>
> class Downloads::Download \< ActiveRecord::Base  
> belongs\_to :download\_category  
> end

why is this running perfectly in development-mode, but causing problems  
in production mode?

and another couriousity:  
the first time i start my application, it is workinmg fine for 4 to 5  
“clicks”. after that the app hangs and dies with the posted error…  
why?

---

<div class="post-metadata">

**Author:** ![none](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f19dbf/32.png) [@none](https://www.ruby-forum.com/u/none)\
**Post date:** [July 19, 2006, 10:04pm UTC](https://www.ruby-forum.com/t/rails-mongrel-lighttpd-nameerror-in-production/98963/3 "2006-07-19T22:04:55Z")

</div>

On Wed, 2006-07-19 at 18:11 +0200, none wrote:

> it’s me again,
> 
> i found that it doesn’t change a thing if i run my rails app in  
> production mode on a webrick-server on my home-machine (suse 10.1). so  
> it’s NOT a mongrel/lighttpd related problem!

Good.

> seems like there a re problems with my models being nested in a  
> subfolder. for example:
> 
> > [@](#):
> >
> > class Downloads::Download \< ActiveRecord::Base  
> > belongs\_to :download\_category  
> > end

BOOM! Models in modules DO NOT WORK. I wasted about 3 weeks struggling  
with this on one team and it turned out nothing about it works. Putting  
controllers in modules is no problem, but Models just fails miserably  
and constantly.

I’ve been rounds with rails-core over this misfeature, and the only  
response is that I’m a jerk so don’t expect it to improve soon.

Apart from the above naming and loading errors, there’s also a logical  
error in how they’re implemented where if you have Downloads::Download  
then the table should match with downloads\_downloads, other wise you  
have clashes when you have FooBar::Download in another module since they  
both use “downloads” as the table. You also have problems loading  
fixtures, naming fixtures, accessing two models with the same name, and  
many other problems.

In other words, give up your foolish notion of putting everything in a  
module just like Java and embrace that you’ll have a monster model in  
the root namespace. You’ll be much happier.

–  
Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

[http://mongrel.rubyforge.org/](http://mongrel.rubyforge.org/)  
[http://www.railsmachine.com/](http://www.railsmachine.com/) – Need Mongrel support?

---

<div class="post-metadata">

**Author:** ![none](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f19dbf/32.png) [@none](https://www.ruby-forum.com/u/none)\
**Post date:** [July 20, 2006, 11:10am UTC](https://www.ruby-forum.com/t/rails-mongrel-lighttpd-nameerror-in-production/98963/4 "2006-07-20T11:10:08Z")

</div>

Zed S. wrote:

> In other words, give up your foolish notion of putting everything in a  
> module just like Java and embrace that you’ll have a monster model in  
> the root namespace. You’ll be much happier.

you got me there: i’m a java boy. or at least college tried to make me,  
before i discovered ruby. so thank you for your quick reply! i’ll take a  
look into it…
