2007-08-24

Rails on SQLite3 - db errors

If you get

error Before updating scaffolding from new DB schema, try creating a table for your model (Contact)

while scaffolding application using SQLite3, remember to instruct Rails correctly where are your database files:

In ./config/database.yml file:
development:
  adapter: sqlite3
  database: db/devel

The names are correct if you created your database in db directory, e.g.:

$ cd ./db
$ sqlite3 devel < ./create_contacts.sql

where file create_contacts.sql contains your SQL command for ceating contacts table.


PS
Remember to create table with
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, :-)

No comments: