Sqlite3 error: uninitialized constant API


#1

I’m just starting my first rails app and I can’t figure out this error.
It’s got something to do with connecting to sqlite3…Here’s the
application trace:

/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in `const_missing' /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/driver/native/driver.rb:81:in `open' /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/database.rb:111:in `initialize' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/sqlite_adapter.rb:17:in `new' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/sqlite_adapter.rb:17:in `sqlite3_connection' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `send' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection_without_query_cache=' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/query_cache.rb:54:in `connection=' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:106:in `retrieve_connection' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:20:in `connection' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:734:in `columns' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1663:in `attributes_from_column_definition' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1185:in `initialize_without_callbacks' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/callbacks.rb:236:in `initialize' ./script/../config/../app/controllers/admin/staff_controller.rb:16:in `new'

Any ideas what’s going on?

Thanks for your help!

Eric


#2

For what it’s worth, I also discovered that this error shows up when I
try to generate a scaffold:

eric$ ruby script/generate scaffold Education
exists app/controllers/
exists app/helpers/
exists app/views/education
exists test/functional/
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
identical app/models/education.rb
identical test/unit/education_test.rb
identical test/fixtures/education.yml
uninitialized constant API

I decided that this might have to do with my install, so (on OSX) I
installed Locomotive, and when I ran my application through
Locomotive/lighttpd instead of WEBrick (script/server), I didn’t get the
application error from the initial post. I did, however, still get the
scaffolding error in this post. So I went on to install mysql via MAMP,
and after reconfiguring for mysql, the application seems to work fine.
Scaffolds generate, no application error messages.

Dunno. But I’m just as happy to be using mysql now that it’s installed.