rc3.org

Strong opinions, weakly held

Resolving the NameError problem with Rails 1.2

I’m just posting this because I have been fiddling around with a Rails 1.2 application for days in utter frustration due to an obscure problem. Every time I tried to load a page, I got an error message like this:

Mon Feb 05 11:22:35 -0500 2007: Error calling Dispatcher.dispatch #<NameError: cannot remove Object::COPYRIGHT>

The name of the object that couldn’t be removed has varied. The NameError has also caused a number of other problems that basically left my application dead. Today some searching revealed the problem. In Rails 1.2, you must put include statements inside class definitions. I had the line:

include REXML

outside a class definition and it blew up my whole application. Fun.

This blog post is provided as a service to the next person who runs into this problem.

11 Comments

  1. Wow! This tip was exactly what I needed. Tracking this down would have been very time consuming. Thanks for the tip.

  2. Thank you! I just nearly blew a gasket trying to figure this out. Moving the includes inside the class cured it for me.

  3. Your tip worked for me as well. The strange thing was that although your tip fixed my problem, I hadn’t changed any of the require statements in my code in the last few days, yet the problem appeared only today. I was about to go back a few revisions to ferret out the change responsible for the problems, when I decided to do a google search instead….

    Thanks a million.

  4. i love you i love you!!! thanks. 2 days going crazy. saved by a 10 line blog entry.

  5. This definitely helped me track down the bizarre issue I was having. Thanks!

  6. Two hours of debugging, and this fixes it in two seconds. I’m thrilled, yet slightly angered :-p

  7. Worked like a charm. Thanks!

  8. Rupert Meese

    May 5, 2008 at 5:56 am

    Thanks, that saved my a whole load of time and trouble.

  9. sd.codewarrior

    May 19, 2008 at 10:23 am

    Thanks! This error occurred intermittently in my case which made it particularly ugly. I spent several hours before finding your post.

  10. Thank-you 🙂

Leave a Reply

Your email address will not be published.

*

© 2024 rc3.org

Theme by Anders NorenUp ↑