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
created.
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
end
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
t.timestamps
end
end
def self.down
drop_table :users
end
end
after I am done... I did rake db:migrate version=20090421211825
== CreateUsers: migrating
===================================================-- create_table(:users)
-> 0.0014s
== CreateUsers: migrated (0.0018s)
==========================================
I got schema.rb in db/migrate specifying the CREATE statement of the
USER..
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
sqlite> .tables
sqlite>
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??
If anyone knows, please suggest me what to do ....your response is
highly appreciated
Thanks,
Bhargavi.
--
Posted via http://www.ruby-forum.com/.