[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[Rails] NameError: ApplicationAPI

Markus

7/26/2007 4:20:00 PM

Just for the record...

I've seen occasional mentions of a problem people have had upgrading
existing Rails 1.1.x applications to Rails 1.2.x, leading to complete
failure of the application with the message:

NameError: Neither ApplicationApi or ApplicationAPI found

...but I've never seen a general solution posted, or even an explanation
of what caused it. (Google finds this:

http://weblog.oriontransfer.co.nz/articles/2007/04/12/rails-1-2-2-problem-with-old...

but it appears not to have helped most people).

Yesterday I ran into the problem myself and thought I should post the
probable cause and likely fix for posterity.

The problem: The older application has web services enabled but is not
actually using / defining and web services (i.e., does not define the
class ApplicationAPI). This was not a problem in earlier versions of
Rails as the didn't try to access the API if it wasn't defined; later
versions apparently assume that if you are using web services you have
an API defined.

What is likely to fix it: find the line(s) in config/environments.rb
that disable unused frameworks and make sure that you are disabling
web_services:

config.frameworks -= [:action_web_service, ... ]

You may also need to check config/environments/*.rb as the settings
there would override those in environments.rb.

--MarkusQ