I have an application with multiple models that works perfectly fine in
both development and production.
Now I added yet another model & database table ‘Cluster’ - no
fundamental difference to the other models I added before.
All calls to this model from the regular application on the production
server
such as ‘Cluster.find(:last)’ - or any other request that you could
think of that involves Cluster or clusters - result in:
undefined method `find’ for Cluster:Module
The strange thing is that this model works perfectly
a.) in development.
b.) through a daemon in production which is populating the Cluster db
table. (and is using exactly the same code that causes the errors when
used from the controller or views.)
c.) through the console app on the production server (where I use any
any command on Cluster)
Also of course the find method works normal everywhere including
production in for all other models.
So this looks very strange and impossible to solve for me as I am
relatively new. At the same time I hope that to someone slightly more
experienced it might be something very obvious and easy to fix.
Thanks a lot in advance for any help or ideas!
Justus
such as ‘Cluster.find(:last)’ - or any other request that you could
think of that involves Cluster or clusters - result in:
undefined method `find’ for Cluster:Module
Sounds like you’ve got something else called Cluster that is only
loaded sometimes but which shadows your model when it is loaded
Fred
Hello Fred, thanks. The only thing I could think of is the
mongrel_cluster. Do you think just renaming the Cluster model everywhere
into something else could do the trick?
Thanks. Justus
Hello Fred, thanks. The only thing I could think of is the
mongrel_cluster. Do you think just renaming the Cluster model
everywhere
into something else could do the trick?
Thanks. Justus
That’s what it looks like. When running under mongrel my app has a
Cluster constant (but not under webrick) and the things in there
certainly look mongrel-related.
Fred
Dear Fred, Thanks so much for your help! That solved the problem. Justus
Sounds like you’ve got something else called Cluster that is only
loaded sometimes but which shadows your model when it is loaded
Fred
Hello Fred, thanks. The only thing I could think of is the
mongrel_cluster. Do you think just renaming the Cluster model
everywhere
into something else could do the trick?
Thanks. Justus
That’s what it looks like. When running under mongrel my app has a
Cluster constant (but not under webrick) and the things in there
certainly look mongrel-related.
Fred
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.