problem with sqlite3....

Hi all,

I am relatively new to ruby and RoR. I created a simple rails proj named
foo by giving command
  -> rails foo --database=sqlite3
It created a new rails proj.. So in that I created a simple db class
named user by using the below command
  -> ruby script/generate model user
so in db/migrate I got a file named 20090421211825_create_users.rb
and in app/models : user.rb got created.
in user.rb.. i have written like this

class User < ActiveRecord::Base
  validate_uniqueness :userid
  validate_presence_of :username

in 20090421211825_create_users.rb, its like this

class CreateUsers < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
      t.integer :userid
      t.string :username, :limit => 32

  def self.down
    drop_table :users

after I am done... I did rake db:migrate version=20090421211825

== CreateUsers: migrating

I got schema.rb in db/migrate specifying the CREATE statement of the
now, I want to see whether my table exists in the db by just giving
-> sqlite3
SQLite version 3.4.0
Enter ".help" for instructions
> .tables

I am not getting my table... I don't know whats wrong with that..Am I
looking into the correct place.... Did I do correctly??

You need to tell sqlite3 which database to look at - pass the path to
your database file as the first argument (eg sqlite3 db/
development.sqlite3 )


Frederick Cheung wrote: