Hello everyone.
I've been working on this book, and it's great.
But now i've been stuck on this for a couple of days now.
I've checked and I made the Users db as expected.
But in the console when I write Users I get:
If I try to migrate again I get :Code:=> User(id: integer, created_at: datetime, updated_at: datetime)
So the table exists and has the necessary Users fields ( login, password, etc )Code:mbp:shovell victormartins$ rake db:migrate (in /Users/victormartins/Dropbox/shovell) == CreateUsers: migrating ==================================================== -- create_table(:users) rake aborted! An error has occurred, this and all later migrations canceled: SQLite3::SQLException: table "users" already exists: CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "login" varchar(255), "password" varchar(255), "name" varchar(255), "email" varchar(255), "created_at" datetime, "updated_at" datetime)
My migrate file looks like this:
Code:class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.string :login t.string :password t.string :name t.string :email t.timestamps end add_column :stories, :user_id, :integer add_column :votes, :user_id, :integer end def self.down drop_table :users remove_column :stories, :user_id, :integer remove_column :votes, :user_id, :integer end end
What can I do to get the Users object to see the tables on the db so I can start creating users?
Thanks in advance.
Victor.






Bookmarks