Gotchya with case sensativity and habtm


Here’s a gotchya that cost me a couple hours. Maybe this will help
someone else.

I had a model :User in a controller. This was code that pre-dated not
needing the model line for most cases. The problem was elsewhere it was
loaded as :user. Apparently, it does a case-sensative compare on what
has already been loaded. Because User != user in this it then loads
User.rb. On Windows, anyway, user.rb and User.rb are the same file. So
the file is loaded twice. It had a habtm association. habtm renames a
method and creates a new method which calls the old. The second time
this happens the old and new method will infinate loop upon each other.

So watch out for case issues or files may be loaded multiple times.

Hope this helps someone.

Jack C.