I’m going to end up hosting a site on a server in a fastcgi environment,
but I’ve been doing most of my development under mongrel. I have a bit
of code that spawns a thread, and in the thread it makes some remote
calls (openuri) and does some database inserts via activerecord.
When I do this under FastCGI, everything appears to work as expected.
When I do it under Mongrel, things almost work but I consistently get
an error when saving records to the database.
I have a class Bookmark, that has a belongs_to relationship with User,
and when I assign the user to the bookmark:
azbm.user = auser
I get the error:
User expected, got User
and then more of a stack trace. Obviously the message is weird (the
class it reports and the class it got are the same). I also know the
code works fine in Mongrel if I’m not using threads, and it works fine
in FastCGI with or without threads.
Any ideas what’s going on? As a workaround, is there any way for me to
tell programmatically whether I’m in Mongrel or FastCGI, so that I can
have the code work during development (albeit slower) and production
(with the use of threads).