Forum: Ruby NameError: ApplicationAPI

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D3bcb48eb7c81b50b4eac82f009001dd?d=identicon&s=25 Markus (Guest)
on 2007-07-26 18:20
(Received via mailing list)
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...

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
This topic is locked and can not be replied to.